Skip to content

Instantly share code, notes, and snippets.

@waltermesser
Created November 1, 2016 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waltermesser/3232c36ea89d17798038f51dae82606d to your computer and use it in GitHub Desktop.
Save waltermesser/3232c36ea89d17798038f51dae82606d to your computer and use it in GitHub Desktop.
(function ($) {
var popupID = 406, // Popup ID # found in the "All Popups" screen
cookie_name = 'loading-popup', // the cookie name in the Popup Editor
close_delay = 500, // (measured in milliseconds) - .5 seconds after page load completes
// --------------------------------
// -- Don't touch below here --
// --------------------------------
popup = '#pum-' + popupID,
$html = $('html'),
classes = 'pum-open pum-open-overlay pum-open-scrollable',
regex = new RegExp(cookie_name + '=');
if (document.cookie.match(regex)) {
$('<style>' + popup + ' {display: block;}</style>').appendTo($('head'));
$html.addClass(classes);
$(document).ready(function () {
setTimeout(function () {
$(popup).fadeOut(function () {
$html.removeClass(classes);
});
}, close_delay);
$.pm_remove_cookie(cookie_name);
});
}
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment