diff --git a/assets/_src/js/ascribe.js b/assets/_src/js/ascribe.js index 2f379b8..0d2ca34 100644 --- a/assets/_src/js/ascribe.js +++ b/assets/_src/js/ascribe.js @@ -75,18 +75,22 @@ function stickyNav() { function mobileNav() { - $('.hamburger').click(function(e) { - e.preventDefault(); - var popup = $('.mobile-nav'); + var hamburger = $('.hamburger'), + popup = $('.mobile-nav'); + + hamburger.click(function(e) { + e.preventDefault(); // toggle popup popup.toggleClass('active'); + hamburger.toggleClass('open'); // bind the hide controls $(document).bind('click.hidepopup', function() { // hide popup popup.removeClass('active'); + hamburger.removeClass('open'); // unbind the hide controls $(document).unbind('click.hidepopup'); }); diff --git a/assets/_src/less/ascribe.less b/assets/_src/less/ascribe.less index d5d2176..b52804f 100644 --- a/assets/_src/less/ascribe.less +++ b/assets/_src/less/ascribe.less @@ -24,6 +24,7 @@ @import 'ascribe/_footer.less'; @import 'ascribe/_hero.less'; +@import 'ascribe/_hamburger.less'; @import 'ascribe/_header.less'; @import 'ascribe/_subtemplates.less'; @import 'ascribe/_feature-circles.less'; diff --git a/assets/_src/less/ascribe/_hamburger.less b/assets/_src/less/ascribe/_hamburger.less new file mode 100644 index 0000000..92d4772 --- /dev/null +++ b/assets/_src/less/ascribe/_hamburger.less @@ -0,0 +1,69 @@ +// +// Ascribe +// ----------------- +// Omnomnom, CSS only hamburger +// + +.hamburger { + cursor: pointer; + margin: 0 5px; + position: relative; + z-index: 50; + width: 25px; + height: 25px; + vertical-align: bottom; + + // button reset + background: none; + box-shadow: none; + border: none; + + span { + &, + &:before, + &:after { + border-radius: 9px; + height: 4px; + width: 100%; + background: @blueBright; + position: absolute; + display: block; + content: ''; + transition: .3s ease-out; + } + + &:before { + top: -8px; + } + + &:after { + bottom: -8px; + } + + } + + // open state + &.open { + span { + background: transparent; + + &:before, + &:after { + top: 0; + } + + &:before { + transform: rotate(45deg); + } + + &:after { + transform: rotate(-45deg); + } + } + + } + + @media screen and (max-width: @phoneWidth) { + display: inline-block; + } +} diff --git a/assets/_src/less/ascribe/_header.less b/assets/_src/less/ascribe/_header.less index 1e7294e..7ac0e66 100644 --- a/assets/_src/less/ascribe/_header.less +++ b/assets/_src/less/ascribe/_header.less @@ -165,8 +165,6 @@ margin-top: 35px; .signInUpText; color: @black; - position:relative; - z-index:3; a { .signInUpText; @@ -177,18 +175,7 @@ } } } -.hamburger { - cursor:pointer; - width: 25px; - margin-left: 15px; - position: relative; - top: 2px; - z-index:50; - @media screen and (max-width: @phoneWidth) { - display: inline-block; - } -} .mobile-nav { display: none; background-color: black; @@ -226,8 +213,9 @@ @media screen and (max-width: @phoneWidth) { display:none; + &.active { - display:block; + display: block; } } } diff --git a/template-header.php b/template-header.php index e61e23a..d354758 100644 --- a/template-header.php +++ b/template-header.php @@ -17,7 +17,9 @@ require 'controller/init.php';