Skip to content

Instantly share code, notes, and snippets.

@cheeaun
Created March 3, 2009 14:34
Show Gist options
  • Save cheeaun/73342 to your computer and use it in GitHub Desktop.
Save cheeaun/73342 to your computer and use it in GitHub Desktop.
Mootools Element extras: isVisible and isHidden
/*
* Inspired from http://github.com/jeresig/sizzle/commit/7631f9c3f85e5fa72ac51532399cb593c2cdc71f
* and this http://github.com/jeresig/sizzle/commit/5716360040a440041da19823964f96d025ca734b
*/
Element.implement({
isVisible: function(){
var w = this.offsetWidth, h = this.offsetHeight;
return (w===0 && h===0) ? false : (w>0 && h>0) ? true : this.getStyle('display') !== 'none';
},
isHidden: function(){
var w = this.offsetWidth, h = this.offsetHeight;
return (w===0 && h===0) ? true : (w!==0 && h!==0) ? false : this.getStyle('display') === 'none';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment