Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active January 28, 2016 14:03
Embed
What would you like to do?
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