Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76b521e

Browse files
committed
add sass snippet
1 parent a501567 commit 76b521e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,22 @@ For 4-column grid it should be:
473473

474474
and so on.
475475

476+
Here is a SASS code snipped which can make life easier (Thanks to @ascendantofrain, [#81](https://github.com/troolee/gridstack.js/issues/81)):
477+
478+
```sass
479+
.grid-stack-item {
480+
481+
$gridstack-columns: 12;
482+
483+
@for $i from 1 through $gridstack-columns {
484+
&[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; }
485+
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
486+
&.grid-stack-item[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; }
487+
&.grid-stack-item[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; }
488+
}
489+
}
490+
```
491+
476492
## Save grid to array
477493

478494
Because gridstack doesn't track any kind of user-defined widget id there is no reason to make serialization to be part

0 commit comments

Comments
 (0)