์ด ํ๋ ์์ํฌ๋ฅผ ์ฌ์ฉํ์ฌ ๋ด ํ๋ก์ ํธ๋ฅผ ์ํด ๋ง๋ ์ฝ๊ฐ์ ๊ฒ์ ๋๋ค.
๋ด ์์ฉ ํ๋ก๊ทธ๋จ๊ณผ ํจ๊ป SASS๋ฅผ ์ฌ์ฉํ๊ณ ์ด ์์ ์กฐ๊ฐ์ ์ฌ์ฉํ๋ฉด ๊ทธ๋ฆฌ๋๋ฅผ ํจ์ฌ ์ฝ๊ฒ ์กฐ์ ํ ์ ์์ต๋๋ค.
.grid-stack-item {
$gridstack-columns: 12;
<strong i="7">@for</strong> $i from 1 through $gridstack-columns {
&[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; }
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; }
}
}
๊ทํ์ ์ค๋ํซ์ผ๋ก README๋ฅผ ์ ๋ฐ์ดํธํ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
๋ํ์ ๋ฆ์์ง๋ง ๋ฐ์ํ ๋ฐ ์ ๋์ ์ด๋ผ๋ ๊ฒ์ด ํญ์ ์์ ๋ง๋๊ณ ์๋ํ๋ ๊ฒ์ ์๋๊ธฐ ๋๋ฌธ์ ๋ฐฑ๋ถ์จ ๋๋ ํฝ์ ๋จ์์ ๋๋น ๋ณ์๋ฅผ ์ํ ์๋ ์์ต๋๋ค. ํ ๊ฐ์ง๋ ๋ฐ์ํ ์ปจํ ์ด๋๋ฅผ ๊ฐ๋ ๊ฒ์ด๊ณ ๋ค๋ฅธ ํ๋๋ ๋ฐ์ํ ์์ ฏ์ด๋ฏ๋ก ๋๋๋ก ํฝ์ ์น์๋ฅผ ๊ฐ๋ ๊ฒ์ด ๋์ ์๊ฐ์ ์๋๋๋ค.
๋ฐ๋ผ์ ํด๋น ๋ ผ๋ฆฌ๋ฅผ ๋ฏธ๋์ด ์ฟผ๋ฆฌ์ ๋ฃ์ผ๋ฉด ๋ค๋ฅธ ํฝ์ /๋ฐฑ๋ถ์จ ๊ธฐ๋ฐ ์์ ฏ ํฌ๊ธฐ๋ฅผ ๊ฐ์ง ์ ์์ต๋๋ค.
$gridstack-columns: 12;
$resolution: 1440px;
<strong i="7">@media</strong> (min-width: 1440px) {
.container {
.grid-stack {
.grid-stack-item {
position: absolute !important;
<strong i="8">@for</strong> $i from 1 through $gridstack-columns {
&[data-gs-width='#{$i}'] { width: ($resolution / $gridstack-columns) * $i; }
&[data-gs-x='#{$i}'] { left: ($resolution / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-min-width='#{$i}'] { min-width: ($resolution / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-max-width='#{$i}'] { max-width: ($resolution / $gridstack-columns) * $i; }
}
}
}
}
}
๋ค์์ ๋ CSS ๋ฒ์ ์ ๋๋ค.
<strong i="6">@columns</strong>: 6;
.gs-item(@n) when (<strong i="7">@n</strong> > 0) {
.gs-item(<strong i="8">@n</strong> - 1);
&[data-gs-width="@{n}"] { width: (100% / @columns) * @n; }
&[data-gs-x="@{n}"] { left: (100% / @columns) * @n; }
&[data-gs-min-width="@{n}"] { min-width: (100% / @columns) * @n; }
&[data-gs-max-width="@{n}"] { max-width: (100% / @columns) * @n; }
}
.grid-stack-item {
.gs-item(@columns);
}
@ascendantofrain @cspeer @troolee @radiolips ์ด๊ฒ ์ฌ์ ํ ์๋ํฉ๋๊น?
๋๋ ์ด์ 36์ผ๋ก ๋ง๋ค๊ณ , sass๋ฅผ ์คํํ๊ณ , ์ฝ๋์์ ์ฌ์ฉํ์ผ๋ฉฐ, ๋๋น๋ ์ด์ 36 ์ด์ ๊ธฐ๋ฐ์ผ๋ก %s๋ฅผ ์ฌ์ฉํ์ง๋ง ๋์ด์ ๋๊ธฐ์ ์ํ์ง ์๋ ๊ฒฝํ์ด ์์ต๋๋ค. 36์ด ๊ทธ๋ฆฌ๋์์ ๋์ด๋ค ๋์ ์ ์์ผ๋ฉฐ ์ฌ๊ธฐ ์ ๊ธฐ๋ก ๊ณ์ ์์ง์
๋๋ค. js ๋ณ๊ฒฝ ์ฌํญ๋ ํ์ํ์ต๋๊น? ์๋ฎ์...
@mandys @ascendantofrain ํต์ฌ gridstack.css ์คํ์ผ ๋๋ฌธ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์ฌ์ ์ํด์ผ ํฉ๋๋ค.
.grid-stack > .grid-stack-item {
$gridstack-columns: 200;
<strong i="8">@for</strong> $i from 1 through $gridstack-columns {
&[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; }
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; }
}
}
ํ์ง๋ง ์์ดํ ์ด ๊ฒน์น๋ ๋ฌธ์ ๋ ์์ง ํ์ง ๋ชปํ์ต๋๋ค.
๋ฒ์ 0.3์์ ์๋ํ๋ ค๋ฉด min-width
๋ ์ถ๊ฐํด์ผ ํ์ต๋๋ค(์ค๋ณต ๋ฌธ์ btw๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ์ฌ์ฉ).
.grid-stack > .grid-stack-item {
$gridstack-columns: 36;
<strong i="7">@for</strong> $i from 1 through $gridstack-columns {
&[data-gs-width='#{$i}'] {
width: (100% / $gridstack-columns) * $i;
min-width: (100% / $gridstack-columns) * $i;
}
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-min-width='#{$i}'] { min-width: (100% / $gridstack-columns) * $i; }
&.grid-stack-item[data-gs-max-width='#{$i}'] { max-width: (100% / $gridstack-columns) * $i; }
}
}