bundle update
.bundle exec jekyll build
๋ก ๋ก์ปฌ์์ ํ
์คํธํ์ต๋๋ค.github-pages
๋๋ jekyll
gem ๋ฒ์ : jekyll 3.2.1์๋ ํ์ธ์, ํ๋ฅญํ ์์ ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
๋๋ ํค๋ ์คํฑ์ ๋ง๋ค๋ ค๊ณ ์๋ํ์ง๋ง ์คํจํ์ต๋๋ค.
_masterhead.scss
๋ฅผ fixed
๋ก ์
๋ฐ์ดํธํ ๋ค์ sidebar
๋ฐ main
์ปจํ
์ด๋์ ์ฌ๋ฐฑ์ ๊ฐ์ง๊ณ ํ๋ ์ดํ์ง๋ง ์คํฌ๋กค๊ณผ sticky
์ฌ์ด๋๋ฐ js๊ฐ ํค๋๋ฅผ ๊ณ์ ์๋ง์ผ๋ก ๋ง๋ญ๋๋ค.
์ด๊ฒ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ๋ฐฉ๋ฒ์ด๋ ํ ํ๋ฆฟ์ ๊ธฐ๋ฅ์ผ๋ก ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ์๋ ค์ฃผ์ค ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค.
๋ค์์ ์์ํ๊ธฐ ์ํ ๋ช ๊ฐ์ง ํํธ์ ๋๋ค.
.masthead {
- position: relative;
+ position: fixed;
+ top: 0;
border-bottom: 1px solid #f2f3f3;
-webkit-animation: intro 0.3s both;
animation: intro 0.3s both;
-webkit-animation-delay: 0.15s;
animation-delay: 0.15s;
z-index: 20;
+ width: 100%;
+ background: white; // set a color to hide content that may appear below masthead
+ height: 85px; // need a magic number here which may break in different viewports
}
๊ทธ๋ฌ๋ฉด ์ฌ๋ฐ๋ฅธ ์์น์ ๋ง์คํธํค๋์ ๋ฉ๋ด๊ฐ ํ์๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ๋ณธ๋ฌธ ๋ด์ฉ๊ณผ ๊ฒน์น๊ฒ ๋ฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด ๋ง์คํธํค๋(๋๋ ๊ทธ ์ด์)์ ๋์ด์ ์ผ์นํ๋ ํจ๋ฉ์ ์๋จ์ ์ถ๊ฐํ์ฌ ์ง์์ผ ํฉ๋๋ค.
body {
margin: 0;
- padding: 0;
+ padding: 85px 0 0; // padding-top equal to masthead height or greater
color: #494e52;
font-family: -apple-system,".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande",Arial,sans-serif;
line-height: 1.5;
}
์ด๊ฒ์ ๋น์ ์ด ํ์๋ก ํ๋ ๊ฒ์ ๋งค์ฐ ๊ฐ๊น๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ์์ฑ์ ์ฌ์ด๋๋ฐ๊ฐ sticky
ํด๋ฆฌํ ์คํฌ๋ฆฝํธ๋ก "๊ณ ์ฐฉ"๋์์ต๋๋ค. ์ด๋ฅผ ๋ณต์ ํ๊ณ ์์น๋ฅผ ๊ณ์ฐํ ๋ค์ ์์ฑ์ ์ง์ํ์ง ์๋ ๋ธ๋ผ์ฐ์ ์ ๋ํด position: sticky
๋ฅผ ๊ฐ์ง๋ก ์ฌ๋ฐฐ์นํ์ฌ ์ผ๋ถ ๋ถ๋๊ต๋ฅผ ์ํํฉ๋๋ค.
๊ณ ์ ๋ง์คํธํค๋์ ๋ํด ๋ค๋ฅธ CSS๋ฅผ ์ ๊ณฑํ๋ฉด ๊ทธ์ ๋ฐ๋ผ ์์ฑ์ ์ฌ์ด๋๋ฐ๊ฐ ์กฐ์ ๋ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ํด๋น ์คํฌ๋ฆฝํธ๋ฅผ ๊ฐ์ง๊ณ ๋์์ผ ํ ์๋ ์์ต๋๋ค. https://github.com/wilddeer/stickyfill
๋ด ๊ฐ์ธ ์ฌ์ดํธ ์๋ ๊ณ ์ ๋ ์์น์ ๋ง์คํธํค๋๊ฐ ์์ต๋๋ค. ์ฝ๋๋ฒ ์ด์ค๋ ์ด ์ฃผ์ ์ ๋ํด 1:1์ด ์๋์ง๋ง ๋์ผํ ์คํฌ๋ฆฝํธ์ ํญ๋ชฉ์ ๋ง์ด ๊ณต์ ํฉ๋๋ค. ์์ ์ ์ ์ฌํญ์ด ์ ์ฉ๋์ง ์๋ ๊ฒฝ์ฐ ์๋ํ๋๋ก ํ๋ ๋ช ๊ฐ์ง ์์ด๋์ด๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
๊ฐ์ฌ ํด์!
์ค์ ๋ก ๊ทํ์ ์ฌ์ดํธ๋ฅผ ํ์ธํ๋ ๊ฒ์ด ๋ง์ ๋์์ด ๋์์ต๋๋ค! ๋ฐฐ๊ฒฝ๊ณผ ์ฌ์ด๋๋ฐ ํจ๋ฉ์ด ๋๋ฝ๋์์ต๋๋ค.
๋น ๋ฅธ ์ง๋ฌธ, ํจ๋ฉ์ ๋ณธ๋ฌธ์ ์ ์ฉํ์ง ์๊ณ #main
์ปจํ
์ด๋์ ์ ์ฉํ์ต๋๋ค. ์คํ์ผ์ ์ฐจ์ด๊ฐ ์๋์?
๋๊ตฐ๊ฐ๊ฐ ๊ทธ๊ฒ์ ์ฌ์ฉํ๊ธฐ๋ฅผ ์ํ ๊ฒฝ์ฐ๋ฅผ ๋๋นํ ์ต์ข diff๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. ๋ฒ ์ด์ค๋ฅผ ์์ ํ๊ธฐ ๋๋ฌธ์ ๋ผ์ธ์ด ์๋ ์ปค๋ฐ๊ณผ 100% ์ ์ฌํ์ง ์์ ์ ์์ง๋ง ์ฐพ๊ธฐ๊ฐ ์ด๋ ต์ง ์์์ผ ํฉ๋๋ค.
.masthead {
- position: relative;
+ position: fixed;
+ top: 0;
+ width: 100%;
+ height: $masthead-height;
+
border-bottom: 1px solid $border-color;
-webkit-animation: intro 0.3s both;
animation: intro 0.3s both;
@@ -16,6 +20,7 @@
<strong i="10">@include</strong> clearfix;
padding: 0.1em 0.1em 0.1em;
font-family: $sans-serif-narrow;
+ background-color: #fff;
<strong i="11">@include</strong> breakpoint($x-large) {
max-width: $x-large;
diff --git a/_sass/_page.scss b/_sass/_page.scss
index e95f07d..487c5c7 100644
--- a/_sass/_page.scss
+++ b/_sass/_page.scss
@@ -6,6 +6,7 @@
<strong i="12">@include</strong> container;
<strong i="13">@include</strong> clearfix;
margin-top: 2em;
+ padding-top: $masthead-height;
padding-left: 1em;
padding-right: 1em;
animation: intro 0.3s both;
diff --git a/_sass/_sidebar.scss b/_sass/_sidebar.scss
index 9df17ea..712498a 100644
--- a/_sass/_sidebar.scss
+++ b/_sass/_sidebar.scss
@@ -8,6 +8,7 @@
.sidebar {
<strong i="14">@include</strong> clearfix();
+ padding-top: $masthead-height;
margin-bottom: 1em;
<strong i="15">@include</strong> breakpoint($large) {
diff --git a/_sass/_variables.scss b/_sass/_variables.scss
index d14acf0..eec32ee 100644
--- a/_sass/_variables.scss
+++ b/_sass/_variables.scss
@@ -139,3 +139,5 @@ $box-shadow : 0 1px 1px rgba(0, 0, 0, 0.125);
$navicon-width : 28px;
$navicon-height : 4px;
$global-transition : all 0.2s ease-in-out;
+
+$masthead-height : 50px;
๋ด์ฉ๊ณผ ๊ตฌ์ฑ ๋ฐฉ์์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. ๋ชจ๋ ์ฃผ์ ์ฝํ ์ธ ๊ฐ ๋ฉ์ธ์ ์๋ค๋ฉด ํจ๋ฉ์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๊ทธ๊ฒ์ ์๋ํ๊ณ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๋์ง๋ณด์ญ์์ค. ์ ๋๋ก ํ๋ ค๋ฉด ์ํ์ฐฉ์ค๊ฐ ํ์ํ ๊ฒ์ ๋๋ค. ์ ์ด๋ ๋๋ ๋ณดํต ํ๋ค :wink:
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ฐ์ฌ ํด์!
์ค์ ๋ก ๊ทํ์ ์ฌ์ดํธ๋ฅผ ํ์ธํ๋ ๊ฒ์ด ๋ง์ ๋์์ด ๋์์ต๋๋ค! ๋ฐฐ๊ฒฝ๊ณผ ์ฌ์ด๋๋ฐ ํจ๋ฉ์ด ๋๋ฝ๋์์ต๋๋ค.
๋น ๋ฅธ ์ง๋ฌธ, ํจ๋ฉ์ ๋ณธ๋ฌธ์ ์ ์ฉํ์ง ์๊ณ
#main
์ปจํ ์ด๋์ ์ ์ฉํ์ต๋๋ค. ์คํ์ผ์ ์ฐจ์ด๊ฐ ์๋์?๋๊ตฐ๊ฐ๊ฐ ๊ทธ๊ฒ์ ์ฌ์ฉํ๊ธฐ๋ฅผ ์ํ ๊ฒฝ์ฐ๋ฅผ ๋๋นํ ์ต์ข diff๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. ๋ฒ ์ด์ค๋ฅผ ์์ ํ๊ธฐ ๋๋ฌธ์ ๋ผ์ธ์ด ์๋ ์ปค๋ฐ๊ณผ 100% ์ ์ฌํ์ง ์์ ์ ์์ง๋ง ์ฐพ๊ธฐ๊ฐ ์ด๋ ต์ง ์์์ผ ํฉ๋๋ค.