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

improved mobile menu js, fixes #32

This commit is contained in:
Matthias Kretschmann 2016-02-02 22:12:40 +01:00
parent cbe2a38243
commit 0f51def0d7

View File

@ -75,7 +75,28 @@ function stickyNav() {
function mobileNav() {
$('.hamburger').click(function() {
$('.mobile-nav').toggleClass('active');
$('.hamburger').click(function(e) {
e.preventDefault();
var popup = $('.mobile-nav');
// toggle popup
popup.toggleClass('active');
// bind the hide controls
$(document).bind('click.hidepopup', function() {
// hide popup
popup.removeClass('active');
// unbind the hide controls
$(document).unbind('click.hidepopup');
});
// dont close thepop when you click on thepop
popup.on('click', function(e) {
e.stopPropagation();
});
// and dont close thepop now
e.stopPropagation();
});
}