Created
April 17, 2018 05:39
-
-
Save uryu-myao/14091043ed9234371bb001df61a58b05 to your computer and use it in GitHub Desktop.
Full window popup menu
This file contains 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
$(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