Created
November 18, 2013 19:43
-
-
Save j0lvera/7534075 to your computer and use it in GitHub Desktop.
eliquidhouston.com code to adult popup
This file contains hidden or 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
/* Adult Popup Window */ | |
(function($){ | |
"use strict"; | |
var container = $('.modal-container'), | |
over = $('.over'), | |
under = $('.under'), | |
disableScroll = true; | |
if ( ! localStorage.getItem('adult') ) { | |
// prevent mobile devices from scroll | |
document.ontouchmove = function(e){ | |
if(disableScroll){ | |
e.preventDefault(); | |
} | |
} | |
// prevent desktop from scroll | |
$(window).on('mousewheel',function(e) { e.preventDefault(); }); | |
document.body.style.overflow = 'hidden'; | |
container.fadeIn('slow'); | |
over.on('click', function() { | |
localStorage.setItem('adult', 18); | |
container.fadeOut(); | |
$(window).unbind('mousewheel'); | |
document.body.style.overflow = 'auto'; | |
disableScroll = false; | |
}); | |
under.on('click', function() { | |
document.location.href = 'http://google.com'; | |
disableScroll = false; | |
}); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment