Collapse sidebar navigation list on smaller screens
- CSS only solution using "check-box hack" - Add new UI text label `menu_label` in _data/ui-text.yml - Close #607
This commit is contained in:
parent
71ddbf1e70
commit
f9a5225c54
|
@ -8,6 +8,7 @@ en: &DEFAULT_EN
|
||||||
pagination_next : "Next"
|
pagination_next : "Next"
|
||||||
breadcrumb_home_label : "Home"
|
breadcrumb_home_label : "Home"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label : "Toggle Menu"
|
||||||
toc_label : "On This Page"
|
toc_label : "On This Page"
|
||||||
ext_link_label : "Direct Link"
|
ext_link_label : "Direct Link"
|
||||||
less_than : "less than"
|
less_than : "less than"
|
||||||
|
@ -56,6 +57,7 @@ es: &DEFAULT_ES
|
||||||
pagination_next : "Siguiente"
|
pagination_next : "Siguiente"
|
||||||
breadcrumb_home_label : "Inicio"
|
breadcrumb_home_label : "Inicio"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Contenidos"
|
toc_label : "Contenidos"
|
||||||
ext_link_label : "Enlace"
|
ext_link_label : "Enlace"
|
||||||
less_than : "menos de"
|
less_than : "menos de"
|
||||||
|
@ -100,6 +102,7 @@ fr: &DEFAULT_FR
|
||||||
pagination_next : "Suivant"
|
pagination_next : "Suivant"
|
||||||
breadcrumb_home_label : "Accueil"
|
breadcrumb_home_label : "Accueil"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Sur cette page"
|
toc_label : "Sur cette page"
|
||||||
ext_link_label : "Lien direct"
|
ext_link_label : "Lien direct"
|
||||||
less_than : "plus petit que"
|
less_than : "plus petit que"
|
||||||
|
@ -147,6 +150,7 @@ tr: &DEFAULT_TR
|
||||||
pagination_next : "Sonraki"
|
pagination_next : "Sonraki"
|
||||||
breadcrumb_home_label : "Ana Sayfa"
|
breadcrumb_home_label : "Ana Sayfa"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "İçindekiler"
|
toc_label : "İçindekiler"
|
||||||
ext_link_label : "Doğrudan Bağlantı"
|
ext_link_label : "Doğrudan Bağlantı"
|
||||||
less_than : "Şu süreden az: "
|
less_than : "Şu süreden az: "
|
||||||
|
@ -189,6 +193,7 @@ pt: &DEFAULT_PT
|
||||||
pagination_next : "Seguinte"
|
pagination_next : "Seguinte"
|
||||||
breadcrumb_home_label : "Início"
|
breadcrumb_home_label : "Início"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Nesta Página"
|
toc_label : "Nesta Página"
|
||||||
ext_link_label : "Link Direto"
|
ext_link_label : "Link Direto"
|
||||||
less_than : "menos de"
|
less_than : "menos de"
|
||||||
|
@ -227,6 +232,7 @@ pt-BR:
|
||||||
pagination_next : "Próxima"
|
pagination_next : "Próxima"
|
||||||
breadcrumb_home_label : "Home"
|
breadcrumb_home_label : "Home"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Nesta página"
|
toc_label : "Nesta página"
|
||||||
ext_link_label : "Link direto"
|
ext_link_label : "Link direto"
|
||||||
less_than : "meno que"
|
less_than : "meno que"
|
||||||
|
@ -269,6 +275,7 @@ it: &DEFAULT_IT
|
||||||
pagination_next : "Prossima"
|
pagination_next : "Prossima"
|
||||||
breadcrumb_home_label : "Home"
|
breadcrumb_home_label : "Home"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Indice della pagina"
|
toc_label : "Indice della pagina"
|
||||||
ext_link_label : "Link"
|
ext_link_label : "Link"
|
||||||
less_than : "meno di"
|
less_than : "meno di"
|
||||||
|
@ -311,6 +318,7 @@ zh: &DEFAULT_ZH
|
||||||
pagination_next : "向后"
|
pagination_next : "向后"
|
||||||
breadcrumb_home_label : "首页"
|
breadcrumb_home_label : "首页"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "在本页上"
|
toc_label : "在本页上"
|
||||||
ext_link_label : "直接链接"
|
ext_link_label : "直接链接"
|
||||||
less_than : "少于"
|
less_than : "少于"
|
||||||
|
@ -359,6 +367,7 @@ de: &DEFAULT_DE
|
||||||
pagination_next : "Nächste"
|
pagination_next : "Nächste"
|
||||||
breadcrumb_home_label : "Home"
|
breadcrumb_home_label : "Home"
|
||||||
breadcrumb_separator : "/"
|
breadcrumb_separator : "/"
|
||||||
|
menu_label :
|
||||||
toc_label : "Auf dieser Seite"
|
toc_label : "Auf dieser Seite"
|
||||||
ext_link_label : "Direkter Link"
|
ext_link_label : "Direkter Link"
|
||||||
less_than : "weniger als"
|
less_than : "weniger als"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
{% assign navigation = site.data.navigation[include.nav] %}
|
{% assign navigation = site.data.navigation[include.nav] %}
|
||||||
|
|
||||||
<nav class="nav__list">
|
<nav class="nav__list">
|
||||||
{% if page.sidebar.title %}<header><h4 class="nav__title" style="padding: 0;">{{ page.sidebar.title }}</h4></header>{% endif %}
|
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %}
|
||||||
<ul>
|
<input id="ac-toc" name="accordion-toc" type="checkbox" />
|
||||||
|
<label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
|
||||||
|
<ul class="nav__items">
|
||||||
{% for nav in navigation %}
|
{% for nav in navigation %}
|
||||||
<li>
|
<li>
|
||||||
{% if nav.url %}
|
{% if nav.url %}
|
||||||
|
|
|
@ -290,6 +290,8 @@ nav {
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
display: block;
|
||||||
|
padding-bottom: 0.25em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,39 @@
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
|
|
||||||
.nav__list {
|
.nav__list {
|
||||||
font-size: 1.25rem;
|
margin: 2em 0 1.5em 0;
|
||||||
|
|
||||||
|
input[type="checkbox"],
|
||||||
|
label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include breakpoint(max-width $large) {
|
||||||
|
|
||||||
|
label {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
font-size: $type-size-6;
|
||||||
|
border: 1px solid $light-gray;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
z-index: 20;
|
||||||
|
-webkit-transition: 0.2s ease-out;
|
||||||
|
transition: 0.2s ease-out;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #fff;
|
||||||
|
border-color: $gray;
|
||||||
|
background-color: mix(white, #000, 20%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* selected*/
|
||||||
|
input:checked + label {
|
||||||
|
color: white;
|
||||||
|
background-color: mix(white, #000, 20%);
|
||||||
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
@ -323,12 +355,12 @@
|
||||||
a {
|
a {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.125em 0;
|
padding: 0.125em 0;
|
||||||
color: inherit;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
margin-left: -0.5em;
|
margin-left: -0.5em;
|
||||||
|
@ -345,6 +377,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav__list .nav__items {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
|
||||||
|
@include breakpoint(max-width $large) {
|
||||||
|
position: relative;
|
||||||
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 10;
|
||||||
|
-webkit-transition: 0.3s ease-in-out;
|
||||||
|
transition: 0.3s ease-in-out;
|
||||||
|
-webkit-transform: translate(0, 10%);
|
||||||
|
-ms-transform: translate(0, 10%);
|
||||||
|
transform: translate(0, 10%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include breakpoint(max-width $large) {
|
||||||
|
.nav__list input:checked ~ .nav__items {
|
||||||
|
-webkit-transition: 0.5s ease-in-out;
|
||||||
|
transition: 0.5s ease-in-out;
|
||||||
|
max-height: 100vh;
|
||||||
|
opacity: 1;
|
||||||
|
margin-top: 1em;
|
||||||
|
-webkit-transform: translate(0, 0);
|
||||||
|
-ms-transform: translate(0, 0);
|
||||||
|
transform: translate(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.nav__title {
|
.nav__title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
font-family: $sans-serif-narrow;
|
font-family: $sans-serif-narrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3, h4 {
|
|
||||||
font-size: $type-size-5;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, li {
|
p, li {
|
||||||
font-family: $sans-serif;
|
font-family: $sans-serif;
|
||||||
font-size: $type-size-6;
|
font-size: $type-size-6;
|
||||||
|
|
Loading…
Reference in a new issue