-
-
Save billerickson/3913c2e5dd15338c049c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
// Display mobile menu | |
$('.mobile-menu-toggle').click(function(e){ | |
e.preventDefault(); | |
$('.site-header').toggleClass('mobile-menu-active'); | |
$(this).find('span').toggleClass('hidden'); | |
}); | |
// Hide mobile menu when clicking back in iOS | |
// @link: http://www.billerickson.net/code/safari-back-hide-mobile-nav | |
$(window).bind("pageshow", function(event) { | |
if (event.originalEvent.persisted) { | |
$('.site-header').removeClass('mobile-menu-active'); | |
$('.mobile-menu-toggle .open').removeClass('hidden'); | |
$('.mobile-menu-toggle .close').addClass('hidden'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment