X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fshowwin.js;h=dfd3714f8ec668a14cf74e7fa029c9ef236050af;hp=c900ab4decbd10e92094e6e57f4f7aee04561e3f;hb=7a52825ce5f25653945b6f1ba8f1aa0098f95863;hpb=bf4ffba811821b98c05460149d8bf2d8cc807a29 diff --git a/include/showwin.js b/include/showwin.js index c900ab4..dfd3714 100644 --- a/include/showwin.js +++ b/include/showwin.js @@ -9,7 +9,7 @@ */ /* - Hidable "fullscreen" Window for Slideshow + Hideable "fullscreen" Window for Slideshow */ var showWindow = new Class({ @@ -19,7 +19,7 @@ var showWindow = new Class({ zIndex: 2, container: document.body, tohide: '', - onClick: $empty, + onClick: $empty } }, @@ -32,7 +32,7 @@ var showWindow = new Class({ this.container = new Element('div').addClass(name). setProperties({ id: name, - name: name, + name: name }).setStyles({ position: 'absolute', left: '0px', @@ -45,18 +45,18 @@ var showWindow = new Class({ this.options.onClick() }.bind(this)).injectInside(this.options.container); - 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; } @@ -66,13 +66,21 @@ 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', + display: 'none' }); } this.bodystyles = document.body.getStyles( @@ -81,8 +89,9 @@ var showWindow = new Class({ document.body.setStyles({ overflow: 'hidden', 'overflow-x': 'hidden', - 'overflow-y': 'hidden', + 'overflow-y': 'hidden' }); + this.position(); this.container.setStyle('display', 'block'); }, @@ -92,7 +101,12 @@ var showWindow = new Class({ } document.body.setStyles(this.bodystyles); this.container.setStyle('display', 'none'); + }, + + grab: function(obj){ + return this.container.grab(obj); } -}) +}); + showWindow.implement(new Options);