1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-11 23:55:16 +01:00

simpler menu js, super smooth menu show/hide

This commit is contained in:
Matthias Kretschmann 2015-08-19 01:31:58 +02:00
parent 1bd309a7eb
commit f55e3d9783
7 changed files with 53 additions and 37 deletions

View File

@ -95,25 +95,19 @@ var siteNavigation = {
}, },
siteMenu: function() { siteMenu: function() {
var $thelink = $('.menu-btn'), var $thesite = $('.site'),
$thelink = $('.menu-btn'),
$thepop = $('.nav-popover'); $thepop = $('.nav-popover');
$thelink.click(function(e) { $thelink.click(function(e) {
e.preventDefault(); e.preventDefault();
// toggle menu // toggle menu
$('body').toggleClass('menu-open'); $thesite.toggleClass('menu-open');
if ($('body').hasClass('menu-open')) {
$thepop.removeClass('hide');
} else {
$thepop.addClass('hide');
}
// bind the hide controls // bind the hide controls
$(document).bind('click.hidethepop', function() { $(document).bind('click.hidethepop', function() {
$('body').removeClass('menu-open'); $thesite.removeClass('menu-open');
$thepop.toggleClass('hide');
// unbind the hide controls // unbind the hide controls
$(document).unbind('click.hidethepop'); $(document).unbind('click.hidethepop');
}); });

View File

@ -40,6 +40,7 @@
.page-single & .page-single &
border: none border: none
padding-top: ($line-height-computed*2)
&:before &:before
@extend .hide @extend .hide
@ -100,15 +101,37 @@
.by .by
display: block display: block
.time
margin-bottom: ($line-height-computed*2)
// Categories & Tags // Categories & Tags
///////////////////////////////////// /////////////////////////////////////
.categories .categories
margin-bottom: 0 margin-bottom: ($line-height-computed/2)
.category .category
text-transform: capitalize @extend .h6, .textcenter
font-size: $font-size-mini
line-height: 1
color: $brand-grey-light
text-transform: uppercase
border: 1px solid $text-color-dimmed
border-radius: $border-radius-base
padding: 4px 8px
margin: 0
display: inline-block
&:hover,
&:focus
color: $link-color
border-color: $link-color
background: rgba(255,255,255,.3)
&:active
background: $link-color
top: 0
color: #fff
.tag .tag
color: $text-color color: $text-color

View File

@ -28,12 +28,6 @@
@import 'alerts' @import 'alerts'
@import 'animations' @import 'animations'
// Components
@import 'header'
@import 'navigation'
@import 'search'
@import 'footer'
// Content // Content
@import 'content' @import 'content'
@import 'content-photo' @import 'content-photo'
@ -45,5 +39,11 @@
@import 'page-about' @import 'page-about'
@import 'page-404' @import 'page-404'
// Components
@import 'header'
@import 'navigation'
@import 'search'
@import 'footer'
// Print // Print
@import 'print' @import 'print'

View File

@ -28,6 +28,11 @@
border-bottom: 1px solid rgba(255,255,255,.7) border-bottom: 1px solid rgba(255,255,255,.7)
box-shadow: 0 1px 4px alpha($brand-dark, .1), 0 -1px 4px alpha($brand-dark, .2) box-shadow: 0 1px 4px alpha($brand-dark, .1), 0 -1px 4px alpha($brand-dark, .2)
transform: translate3d(0,-200px,0)
.menu-open &
transform: translate3d(0,0,0)
@media only screen and (min-width: 40.625em) and (min-height: 650px) @media only screen and (min-width: 40.625em) and (min-height: 650px)
.site .site
position: relative position: relative
@ -38,9 +43,10 @@
z-index: 2 z-index: 2
margin-top: 80px margin-top: 80px
margin-bottom: 420px margin-bottom: 420px
transform: translate3d(0,0,0)
.menu-open & .menu-open &
margin-top: 220px transform: translate3d(0,140px,0)
.site__header, .site__header,
.site__footer .site__footer

View File

@ -41,36 +41,24 @@
.nav-popover .nav-popover
@extend .divider-top, .list-unstyled @extend .divider-top, .list-unstyled
padding: $line-height-computed 0 padding: $line-height-computed 0
margin-top: 30px margin-top: $line-height-computed
margin-bottom: 0 margin-bottom: 0
width: 100% width: 100%
background: $body-bg background: $body-bg
display: flex display: flex // .nav-popver overwrite
margin-left: 0 // .grid overwrite
.grid__col .grid__col
padding-top: 0 padding-top: 0
.nav-link .nav-link
@extend .h6, .textcenter @extend .category
text-shadow: 0 1px 0 rgba(#fff, .5) text-shadow: 0 1px 0 rgba(#fff, .5)
padding: $padding-base-vertical $padding-base-horizontal padding: $padding-base-vertical $padding-base-horizontal
margin-bottom: 0 margin-bottom: 0
margin-top: 0 margin-top: 0
display: block display: block
color: $brand-grey-light border: none
text-transform: uppercase
border-radius: $border-radius-base
&:hover,
&:focus
color: $link-color
border-bottom-color: $link-color
background: rgba(255,255,255,.5)
&:active
background: $link-color
top: 0
color: #fff
// Paginator // Paginator

View File

@ -204,6 +204,11 @@ hr
border: 0 border: 0
margin-bottom: ($line-height-computed*2) margin-bottom: ($line-height-computed*2)
.small
font-size: $font-size-small
.mini
font-size: $font-size-small
// Quotes // Quotes
///////////////////////////////////// /////////////////////////////////////

View File

@ -35,7 +35,7 @@
</div> </div>
<ul class="nav-popover grid grid--gutters grid--half grid-medium--third hide"> <ul class="nav-popover grid grid--half grid-medium--third">
{% for category in site.categories %} {% for category in site.categories %}
<li class="grid__col"> <li class="grid__col">
<a class="nav-link" href="/{{ category | first }}/"> <a class="nav-link" href="/{{ category | first }}/">