Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created November 26, 2010 16:44
Show Gist options
  • Save walterdavis/716940 to your computer and use it in GitHub Desktop.
Save walterdavis/716940 to your computer and use it in GitHub Desktop.
//Light2box ©2010 Walter Davis Studio
if(! $('page_overlay')){
//create the overlay
var overlay = new Element('div',{id:'page_overlay'});
$$('body').first().insert(overlay);
overlay.setStyle('position:fixed; height:100%; width:100%; background: rgba(0,0,0,0.7) url(/images/ajaxloadreverse.gif) no-repeat center 150px; top:0;left:0; z-index:1000; display:none;');
//pretend that IE is a worthwhile browser
if(Prototype.Browser.IE){
overlay.setStyle('position:absolute; background:url(/images/ajaxloadreverse.gif) no-repeat center 150px; -ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000); zoom: 1;');
var h = document.viewport.getScrollOffsets()[1];
overlay.setStyle({"top":h + "px"});
Event.observe(window,"scroll",function(evt){
var h = document.viewport.getScrollOffsets()[1];
overlay.setStyle({"top":h + "px"});
});
}
overlay.update('<div id="content_area" style="position:relative; margin:120px auto; padding:20px 40px 30px; background-color:#fff; width:50%; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px;"></div>');
overlay.observe('click',function(evt){this.hide();});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment