Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change style when moving grid items #905

Open
mcrodriguezb opened this issue Feb 3, 2024 · 1 comment
Open

Change style when moving grid items #905

mcrodriguezb opened this issue Feb 3, 2024 · 1 comment

Comments

@mcrodriguezb
Copy link

Hi,

I would like to set a different style when moving items. I was looking to add lines to show the grid limits. Something similar to the gray lines shown in the attached image.
image

Is this possible? if so, how?

Thanks,

@jleroy-dev
Copy link

Hey, I had success in re-styling the grid rows and columns.
Basically, it will remove the default styling, and add absolute positionned borders (in my case I use dot-like borders)

image

$grid-border-color: YOUR_BORDER_COLOR;

gridster {
  // Optional
  background: transparent !important;

  // Optional
  gridster-item {
    background: transparent !important;
  }

   // Optional, changes the default tile preview (gray square on my screen)
  gridster-preview {
    background-color: rgba($grid-border-color, 0.35) !important;
    border-radius: 10px;
  }

  .gridster-row,
  .gridster-column {
    position: relative;
    border: none !important;
  }

  .gridster-row {
    &::after {
      bottom:-5.5px;
      background-image: linear-gradient(
        to right,
        $grid-border-color 30%,
        rgba($grid-border-color, 0) 0%
      );
      background-repeat: repeat-x;
      background-position: bottom;
      background-size: 5px 1px;
    }
  }

  .gridster-column {
    &::after {
      right: -5.5px;
      background-image: linear-gradient(
        to bottom,
        $grid-border-color 30%,
        rgba($grid-border-color, 0) 0%
      );
      background-repeat: repeat-y;
      background-position: right;
      background-size: 1px 5px;
    }
  }
}

And setting displayGrid option to onDrag&Resize.
Hope it helps others!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants