diff options
author | Valentin Popov <info@valentineus.link> | 2019-03-24 18:46:33 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2019-03-24 20:48:39 +0300 |
commit | 9f1e42d5253bb58f2543cbc93a1ef4b128849f9f (patch) | |
tree | dec6e3b1c57df2f81ad73cd7b480d8d4307f75a6 | |
parent | 456eeb794b3e2f8b34cdf982835bd628e849fdf5 (diff) | |
download | popov.link-9f1e42d5253bb58f2543cbc93a1ef4b128849f9f.tar.xz popov.link-9f1e42d5253bb58f2543cbc93a1ef4b128849f9f.zip |
Add an animation menu on the only CSS
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | _includes/navbar.html | 35 | ||||
-rw-r--r-- | _scss/components/_navigation.scss | 99 |
2 files changed, 87 insertions, 47 deletions
diff --git a/_includes/navbar.html b/_includes/navbar.html index acf5e0c..bac694d 100644 --- a/_includes/navbar.html +++ b/_includes/navbar.html @@ -1,26 +1,15 @@ {% assign pages = site.pages | where: "show", true %} -<nav role="navigation"> - <ul class="nav-pills"> - {% unless page.url == "/index.html" %} - <li role="presentation"> - <strong> - <a class="nav-link" href="/">Home</a> - </strong> - </li> - {% endunless %} +<div class="navigation-container"> + <input id="toggle-button" class="toggle-button" type="checkbox" /> - <!-- Right side --> - <ul class="nav-pills nav-right"> - {% for page in pages %} - <li role="presentation"> - <strong> - <a class="nav-link" href="{{ page.url | strip_newlines | strip_html | strip | normalize_whitespace | relative_url | uri_escape }}"> - {{ page.title | strip_newlines | strip_html | strip | normalize_whitespace | smartify | xml_escape }} - </a> - </strong> - </li> - {% endfor %} - </ul> - </ul> -</nav> + <label class="toggle-label" for="toggle-button"> + <span></span> + <span></span> + <span></span> + </label> + + <nav class="navigation" role="navigation"> + <ul class="navigation-pills"></ul> + </nav> +</div> diff --git a/_scss/components/_navigation.scss b/_scss/components/_navigation.scss index 749a03e..19d37f2 100644 --- a/_scss/components/_navigation.scss +++ b/_scss/components/_navigation.scss @@ -1,36 +1,87 @@ -.nav-pills { - list-style-type: none; - margin: 0; - overflow: hidden; +.navigation-container { + background: $color-bg; + border-left: 1px solid $color-bg-alt; + border-right: 1px solid $color-bg-alt; + height: 100px; + left: 0; + margin: auto; + max-width: 52em; padding: 0; - text-align: center; + position: fixed; + right: 0; + top: 0; + width: 100%; +} + +.toggle-button { + display: none; - li { - float: left; - padding: .5em; + &:checked ~ .navigation { + transform: none; + transition: all .1s; } -} -.nav-link { - text-align: center; - text-decoration: none; - text-transform: uppercase; + &:checked ~ .toggle-label { + span { + opacity: 0; + top: 50%; + } - &:active, - &:focus, - &:hover { - border: 0; - text-decoration: none; + span:first-child { + opacity: 1; + transform: rotate(405deg); + } + + span:last-child { + opacity: 1; + transform: rotate(-405deg); + } } } -.nav-right { +.toggle-label { float: right; -} + height: 20px; + position: relative; + right: 40px; + top: 40px; + width: 15px; + + &:hover { + cursor: pointer; + } + + span { + background: $color-text; + height: 2px; + position: absolute; + top: 50%; + width: 100%; + + &:first-child { + top: 3px; + } -@media (max-width: 382px) { - .nav-right, - .nav-pills li { - float: none; + &:last-child { + top: 16px; + } } } + +.navigation { + background: $color-bg; + border-left: 1px solid $color-bg-alt; + border-right: 1px solid $color-bg-alt; + height: 100%; + left: 0; + margin: auto; + max-width: 52em; + padding: 0; + position: fixed; + right: 0; + top: 100px; + transform: scale(.1, 0); + transform-origin: 100% 0%; + transition: none; + width: 100%; +} |