X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fshowwin.js;h=96568269b88b35f44adffbc9ba751442c16b8cf0;hp=6171ba2ee47ab5538f4bb6392578a7d995576e73;hb=283ceff6555c129d7e03f639aa8a3e158dd2e1ac;hpb=f8281d2d6eaaa20f2c65d9753a2870df1310fd1a diff --git a/include/showwin.js b/include/showwin.js index 6171ba2..9656826 100644 --- a/include/showwin.js +++ b/include/showwin.js @@ -18,6 +18,7 @@ var showWindow = new Class({ return { zIndex: 2, container: document.body, + tohide: '', onClick: $empty, } }, @@ -26,6 +27,7 @@ var showWindow = new Class({ this.setOptions(this.getOptions(), options); this.options.container = $(this.options.container); + this.options.tohide = $(this.options.tohide); this.container = new Element('div').addClass(name). setProperties({ @@ -51,10 +53,12 @@ var showWindow = new Class({ position: function(){ if(this.options.container == document.body){ + this.w = window.getWidth(); this.h = window.getHeight(); this.s = window.getScrollTop(); }else{ var myCoords = this.options.container.getCoordinates(); + this.w = myCoords.width; this.h = myCoords.height; this.s = myCoords.top; } @@ -64,11 +68,39 @@ var showWindow = new Class({ }) }, + getCoordinates: function(){ + return { + width: this.w, + height: this.h, + top: this.s, + }; + }, + show: function(){ + if (this.options.tohide) { + this.hiddenstyles = this.options.tohide.getStyles( + 'display' + ); + this.options.tohide.setStyles({ + display: 'none', + }); + } + this.bodystyles = document.body.getStyles( + 'overflow', 'overflow-x', 'overflow-y' + ); + document.body.setStyles({ + overflow: 'hidden', + 'overflow-x': 'hidden', + 'overflow-y': 'hidden', + }); this.container.setStyle('display', 'block'); }, hide: function(){ + if (this.options.tohide) { + this.options.tohide.setStyles(this.hiddenstyles); + } + document.body.setStyles(this.bodystyles); this.container.setStyle('display', 'none'); } })