So you are saying that the element may have a class with `display: none`?
If so, you'll need to read the computed style using `currentStyle` (IE) and `getComputedStyle` (other browsers).
Check out the last post on this
codingforums.com thread.The final bit of code looks ok, but untested:
Code: Select all
function isVisible(elem) {
var cmpstyle = ('getComputedStyle' in window) ? window.getComputedStyle(elem,null) : elem.currentStyle;
if (parseFloat(cmpstyle.opacity) > 0 &&
cmpstyle.visibility != 'hidden' &&
cmpstyle.display != 'none') {
return true;
}
return false;
}
You'll notice that it also checks if the item is hidden or opacity 0 which may not be useful to you.