1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 09:13:38 +01:00

css only, animated hamburger icon, fixes #32 even more

This commit is contained in:
Matthias Kretschmann 2016-02-02 22:54:20 +01:00
parent 0f51def0d7
commit d3ce8295cb
6 changed files with 87 additions and 19 deletions

View File

@ -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');
});

View File

@ -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';

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -17,7 +17,9 @@ require 'controller/init.php';
<div class="app-links">
<a href="<?php echo $signInLink; ?>">Log In</a> / <a href="<?php echo $signUpLink; ?>">Sign Up</a>
<img src="<?php echo WPTHEME_TEMPLATE_URL; ?>/images/svg/hamburger.svg" class="phone-only hamburger">
<button class="hamburger phone-only">
<span></span>
</button>
</div>
<nav class="tour-switcher"><?php wp_nav_menu( array(

View File

@ -20,7 +20,11 @@ $controller = new Controller();
<a href="<?php echo get_bloginfo('wpurl');?>"><img src="<?php echo WPTHEME_TEMPLATE_URL; ?>/images/logo/ascribeicon-white.svg" class="logo phone-only"></a>
<div class="app-links">
<a href="<?php echo $signInLink; ?>">Log In</a> / <a href="<?php echo $signUpLink; ?>">Sign Up</a>
<img src="<?php echo WPTHEME_TEMPLATE_URL; ?>/images/svg/hamburger.svg" class="phone-only hamburger">
<button class="hamburger phone-only">
<span></span>
</button>
</div>
<nav class="tour-switcher"><?php wp_nav_menu( array(
'theme_location' => 'landing-menu',