X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fshowwin.js;h=7e4435745d83c9f567f57cb3cf9b948bd72e920b;hp=daec73a234cb46fab57ffcf3ae744df6acf11a5d;hb=dc476cc5961e6326e9a922f9eb8b1220a6d7ae41;hpb=af2f2275168124e103af685035fafdc0755d45be diff --git a/include/showwin.js b/include/showwin.js index daec73a..7e44357 100644 --- a/include/showwin.js +++ b/include/showwin.js @@ -9,16 +9,16 @@ */ /* - Hidable "fullscreen" Window for Slideshow + Hideable "fullscreen" Window for Slideshow */ var showWindow = new Class({ getOptions: function(){ return { - embed: [], zIndex: 2, container: document.body, + tohide: '', onClick: $empty, } }, @@ -27,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({ @@ -44,28 +45,18 @@ var showWindow = new Class({ this.options.onClick() }.bind(this)).injectInside(this.options.container); - this.embedded = []; - this.options.embed.each(function(el){ - var sub = new Element('div'); - sub.addClass(el).setProperties({ - id: el, - name: el, - }).injectInside(this.container); - this.embedded.push(sub); - },this); - - this.position(); - window.addEvent('resize', this.position.bind(this)); window.addEvent('scroll', this.position.bind(this)); }, 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; } @@ -75,11 +66,40 @@ 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.position(); 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'); } })