Skip to content

Instantly share code, notes, and snippets.

@theskillwithin
Created December 22, 2015 15:50
Show Gist options
  • Save theskillwithin/607825d89b8f501b49f6 to your computer and use it in GitHub Desktop.
Save theskillwithin/607825d89b8f501b49f6 to your computer and use it in GitHub Desktop.
// nav
function nav() {
if ($(window).width() < 788) {
$('.mobile-nav-toggle').on('click', function() {
$('.left').css('display', 'block');
$('.left').css('top', '50%');
});
$('.mobile-nav-toggle').on('click', function() {
$('.left').css('top', '85px');
});
// click anywhere to cose
$('html').click(function() {
$('.left').css('top', '-400px');
});
$('.left').click(function(event) {
event.stopPropagation();
});
$('.mobile-nav-toggle').click(function(event) {
event.stopPropagation();
});
$('.left').on('touchstart', function(event) {
event.stopPropagation();
});
$('.mobile-nav-toggle').on('touchstart', function(event) {
event.stopPropagation();
});
} else {
$('.left').removeAttr( 'style' );
}
}
$(window).resize(nav());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment