Created
November 22, 2010 12:33
-
-
Save Takazudo/709904 to your computer and use it in GitHub Desktop.
$.ui.overflowKiller - kill overflow temporary.
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
/** | |
* $.ui.overflowKiller | |
* attach this to 'html' | |
*/ | |
$.widget('ui.overflowKiller', { | |
options: { | |
killXY: false, | |
killX: true, | |
killY: false | |
}, | |
kill: function(){ | |
var $el = this.element; | |
var o = this.options; | |
this._lastOverflow = $el.css('overflow'); | |
this._lastOverflowX = $el.css('overflow-x'); | |
this._lastOverflowY = $el.css('overflow-y'); | |
var vals = {}; | |
if(o.killXY){ vals.overflow = 'hidden'; } | |
if(o.killX){ vals.overflowX = 'hidden'; } | |
if(o.killY){ vals.overflowY = 'hidden'; } | |
$el.css(vals); | |
return this; | |
}, | |
resurrect: function(){ | |
var vals = {}; | |
var o = this.options; | |
if(o.killXY){ vals.overflow = this._lastOverflow; } | |
if(o.killX){ vals.overflowX = this._lastOverflowX; } | |
if(o.killY){ vals.overflowY = this._lastOverflowY; } | |
this.element.css(vals); | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment