Skip to content

Instantly share code, notes, and snippets.

@uryu-myao
Created April 17, 2018 05:39
Show Gist options
  • Save uryu-myao/14091043ed9234371bb001df61a58b05 to your computer and use it in GitHub Desktop.
Save uryu-myao/14091043ed9234371bb001df61a58b05 to your computer and use it in GitHub Desktop.
Full window popup menu
$(function(){
var scrT;
$('.menu-trigger').on('click',function(){
if(!$('#menu-cover').hasClass('is_active')){
$('.menu-trigger').one('click',openMainMenu());
} else {
// console.log(scrT);
$('.close-holder').one('click',closeMainMenu());
}
});
function openMainMenu(){
scrT = $(window).scrollTop();
$('#menu-cover').addClass('is_active');
$('body').css({
position: 'fixed',
width: '100%',
top: -1 * scrT,
});
}
function closeMainMenu(){
$('#menu-cover').removeClass('is_active');
$('body').css({
position: 'inherit',
top:'auto',
});
$(window).scrollTop(scrT);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment