Created
February 6, 2012 23:34
-
-
Save craigmdennis/1755910 to your computer and use it in GitHub Desktop.
Detect if element hasLayout in IE and invoke it if false
This file contains hidden or 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
/** | |
* If you wonder why filter:alpha(opacity=20); sometimes does nothing, | |
* Read http://joseph.randomnetworks.com/2006/08/16/css-opacity-in-internet-explorer-ie/ | |
* Use the function below to detect if an element has layout & to apply it dynamically if not | |
*/ | |
function hasLayout(selector) { | |
$(selector).each(function (index, element) { | |
if (element.currentStyle.hasLayout === false) { | |
$(element).css({ | |
'zoom': 1 | |
}); | |
} | |
}); | |
} | |
hasLayout('img'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment