Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Better yet, here is a SASS code snippet, you can use sites like [sassmeister.com
```sass
$columns: 12;
@function fixed($float) {
@return calc(round($float * 1000) / 1000);
@return calc(round($float * 100) / 100); // total 4 digits being %
}
.grid-stack-#{$columns} > .grid-stack-item {

Expand Down
15 changes: 6 additions & 9 deletions src/gridstack-extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ $gridstack-columns-start: 2 !default;
$gridstack-columns: 11 !default;

@function fixed($float) {
@return calc(round($float * 1000) / 1000);
@return calc(round($float * 100) / 100); // total 4 digits being %
}

@mixin grid-stack-items($columns) {
.grid-stack-#{$columns} {
.grid-stack-#{$columns} > .grid-stack-item {
min-width: fixed(calc(100% / $columns));

> .grid-stack-item {
min-width: fixed(calc(100% / $columns));

@for $i from 1 through $columns - 1 {
&[gs-x='#{$i}'] { left: fixed(calc(100% / $columns) * $i); }
&[gs-w='#{$i+1}'] { width: fixed(calc(100% / $columns) * ($i+1)); }
}
@for $i from 1 through $columns - 1 {
&[gs-x='#{$i}'] { left: fixed(calc(100% / $columns) * $i); }
&[gs-w='#{$i+1}'] { width: fixed(calc(100% / $columns) * ($i+1)); }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $columns: 12 !default;
$animation_speed: .3s !default;

@function fixed($float) {
@return calc(round($float * 1000) / 1000);
@return calc(round($float * 100) / 100); // total 4 digits being %
}

@mixin vendor($property, $value...){
Expand Down