mirror of
https://github.com/ascribe/wp-theme
synced 2025-01-03 10:25:08 +01:00
improved mobile menu js, fixes #32
This commit is contained in:
parent
cbe2a38243
commit
0f51def0d7
@ -75,7 +75,28 @@ function stickyNav() {
|
|||||||
|
|
||||||
|
|
||||||
function mobileNav() {
|
function mobileNav() {
|
||||||
$('.hamburger').click(function() {
|
$('.hamburger').click(function(e) {
|
||||||
$('.mobile-nav').toggleClass('active');
|
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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user