If an element can be seen by human being, ALL of the following must be true:
jQuery(elem).is(':visible')
returns true
. In jQuery 1.3.2+, an element is visible if its browser-reported offsetWidth or offsetHeight is greater than 0.visibility
style is not hidden
.opacity
style is not 0
.However, these do not cover all cases. For instance, one easy case I can think of is, if an element falls outside of one of its ancestors' visible area and that ancestor has a style overflow: hidden
, then the element can not be seen.
Any existing examples/jQuery plugins/etc. that cover most (if not all) of possibilities?
It is impossible to detect whether an element can be seen by human being or not. Here are a few more cases you cannot cover:
[end of irony]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With