angular-gridster2
angular-gridster2 copied to clipboard
Change style when moving grid items
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.
Is this possible? if so, how?
Thanks,
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)
$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!