Skip to content

Instantly share code, notes, and snippets.

@j0lvera
Created November 18, 2013 19:43
Show Gist options
  • Save j0lvera/7534075 to your computer and use it in GitHub Desktop.
Save j0lvera/7534075 to your computer and use it in GitHub Desktop.
eliquidhouston.com code to adult popup
/* 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