\r
/**************************************************************\r
\r
- Script : Overlay\r
+ Script : overlay\r
Version : 1.2\r
Authors : Samuel birch\r
Desc : Covers the window with a semi-transparent layer.\r
\r
**************************************************************/\r
\r
-var Overlay = new Class({\r
+var overlay = new Class({\r
\r
getOptions: function(){\r
return {\r
opacity: 0.7,\r
zIndex: 1,\r
container: document.body,\r
- onClick: Class.empty\r
+ _onClick: $empty\r
};\r
},\r
\r
'id': 'OverlayIframe',\r
'name': 'OverlayIframe',\r
'src': 'javascript:void(0);',\r
- 'frameborder': 1,\r
+ 'frameborder': 0,\r
'scrolling': 'no'\r
}).setStyles({\r
'position': 'absolute',\r
backgroundColor: this.options.colour\r
}).injectInside(this.container);\r
\r
- this.container.addEvent('click', function(){\r
- this.options.onClick();\r
- }.bind(this));\r
+ if(this.options._onClick){\r
+ this.container.addEvent('click', function(){\r
+ this.options._onClick.call(this)\r
+ }.bind(this));\r
+ }\r
\r
- this.fade = new Fx.Tween(this.container, 'opacity').set(0);\r
+ //this.fade = new Fx.Tween(this.container).set('opacity', 0);\r
+ this.container.fade('hide');\r
this.position();\r
\r
window.addEvent('resize', this.position.bind(this));\r
},\r
\r
+ setOnClick: function(func){\r
+ this.container.addEvent('click', func);\r
+ },\r
+ \r
position: function(){ \r
if(this.options.container == document.body){ \r
var h = window.getScrollHeight()+'px'; \r
},\r
\r
show: function(){\r
- this.fade.start(0,this.options.opacity);\r
+ //this.fade.start(0,this.options.opacity);\r
+ this.container.fade(this.options.opacity);\r
},\r
\r
hide: function(){\r
- this.fade.start(this.options.opacity,0);\r
+ //this.fade.start(this.options.opacity,0);\r
+ this.container.fade('out');\r
}\r
\r
});\r
-Overlay.implement(new Options);\r
+overlay.implement(new Options);\r
\r
/*************************************************************/\r