Skip to content

Instantly share code, notes, and snippets.

@eyy
Created January 19, 2014 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyy/8507056 to your computer and use it in GitHub Desktop.
Save eyy/8507056 to your computer and use it in GitHub Desktop.
mobile navigation
/*
Mobile navigation
*/
var nav = $('nav');
nav.on('click touchstart', function(e) {
if (!$(e.target).is('.active'))
return;
e.preventDefault();
e.stopPropagation();
nav.toggleClass('open');
});
$(document).on('click touchstart', function(e) {
if (!nav.find(e.target).length)
nav.removeClass('open');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment