Skip to content

Instantly share code, notes, and snippets.

@fermion
Created September 21, 2009 13:25
Show Gist options
  • Save fermion/190243 to your computer and use it in GitHub Desktop.
Save fermion/190243 to your computer and use it in GitHub Desktop.
function showBlockingPopup(name) {
// make sure overlay covers the entire page
var dimensions = document.viewport.getScrollOffsets();
wrapper = $(name);
// center logo
$(name + '_popup').setStyle({top: (dimensions.top + (document.viewport.getHeight() / 2) - 68) + 'px'});
if(Prototype.Browser.IE) {
var newHeight = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight);
var newWidth = document.documentElement.offsetWidth;
// set height/width on #name and its _blocker, otherwise IE won't let _blocker grow
wrapper.setStyle({height: newHeight + 'px', width: newWidth + 'px'});
$(name + '_blocker').setStyle({height: newHeight + 'px', width: newWidth + 'px'});
} else if(Prototype.Browser.WebKit) {
$(name + '_blocker').setStyle({height: (document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight) + 'px'});
} else {
$(name + '_blocker').setStyle({height: window.innerHeight + window.scrollMaxY + 'px'});
}
wrapper.setStyle({zIndex: Number.MAX_VALUE});
if(Prototype.Browser.IE) {
// setTimeout used so the animated GIF will animate itself
wrapper.show.delay(.1);
} else {
wrapper.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment