X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Foverlay.js;h=078b75a1e93a1d78f67c708a08c280ff8f04c2cf;hp=432a0763790766ca23f67193b61e1df56024d594;hb=d9858398daebccc17dff00309c0f96a94a98e1f2;hpb=e04e3b035dbc99e57bd2b37fb68696718a825297 diff --git a/include/overlay.js b/include/overlay.js index 432a076..078b75a 100644 --- a/include/overlay.js +++ b/include/overlay.js @@ -1,7 +1,7 @@ /************************************************************** - Script : Overlay + Script : overlay Version : 1.2 Authors : Samuel birch Desc : Covers the window with a semi-transparent layer. @@ -9,7 +9,7 @@ **************************************************************/ -var Overlay = new Class({ +var overlay = new Class({ getOptions: function(){ return { @@ -17,7 +17,7 @@ var Overlay = new Class({ opacity: 0.7, zIndex: 1, container: document.body, - onClick: Class.empty + _onClick: $empty }; }, @@ -38,7 +38,7 @@ var Overlay = new Class({ 'id': 'OverlayIframe', 'name': 'OverlayIframe', 'src': 'javascript:void(0);', - 'frameborder': 1, + 'frameborder': 0, 'scrolling': 'no' }).setStyles({ 'position': 'absolute', @@ -61,16 +61,23 @@ var Overlay = new Class({ backgroundColor: this.options.colour }).injectInside(this.container); - this.container.addEvent('click', function(){ - this.options.onClick(); - }.bind(this)); + if(this.options._onClick){ + this.container.addEvent('click', function(){ + this.options._onClick.call(this) + }.bind(this)); + } - this.fade = new Fx.Tween(this.container, 'opacity').set(0); + //this.fade = new Fx.Tween(this.container).set('opacity', 0); + this.container.fade('hide'); this.position(); window.addEvent('resize', this.position.bind(this)); }, + setOnClick: function(func){ + this.container.addEvent('click', func); + }, + position: function(){ if(this.options.container == document.body){ var h = window.getScrollHeight()+'px'; @@ -87,14 +94,16 @@ var Overlay = new Class({ }, show: function(){ - this.fade.start(0,this.options.opacity); + //this.fade.start(0,this.options.opacity); + this.container.fade(this.options.opacity); }, hide: function(){ - this.fade.start(this.options.opacity,0); + //this.fade.start(this.options.opacity,0); + this.container.fade('out'); } }); -Overlay.implement(new Options); +overlay.implement(new Options); /*************************************************************/