Created
December 1, 2010 04:45
-
-
Save GCheung55/722963 to your computer and use it in GitHub Desktop.
A really simple lightbox overlay MooTools Class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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