Skip to content

Instantly share code, notes, and snippets.

@GCheung55
Created December 1, 2010 04:45
Show Gist options
  • Save GCheung55/722963 to your computer and use it in GitHub Desktop.
Save GCheung55/722963 to your computer and use it in GitHub Desktop.
A really simple lightbox overlay MooTools Class.
// Lightbox Overlay
var LightBoxOverlay = new Class({
Implements: [Options, Events],
options:{
tag: 'div',
properties: {
id: 'lightbox_overlay',
'class': 'hide'
}
},
initialize: function(el, options){
this.setOptions(options);
this.element = $(el) || this.createElement(this.options);
},
toElement: function(){
return this.element;
},
createElement: function(options){
return new Element(this.options.tag, this.options.properties);
},
show: function(){
this.resize();
this.fireEvent('show');
return this;
},
hide: function(){
this.fireEvent('hide');
return this;
},
resize: function(el){
var size = ($(el) || window).getScrollSize();
this.element.setStyles({
'height': size.y,
'width': size.x
});
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment