0

I know there is the visible() function in prototype. I cant use it though since it only checks for the inline style display:none. How can I check if an element is visible by looking at its CSS?

Thanks!

user1856596
  • 7,027
  • 10
  • 41
  • 63
  • 1
    What do you mean by `visible` ? – Serge K. Feb 28 '14 at 11:09
  • Do you mean just the target element itself, or any of its parents? For example, the target element may be `display:block` but still be invisible if its parent element is `display:none`. Also, an element may be considered invisible if its total (outer) width and height are 0. – daiscog Feb 28 '14 at 11:11

2 Answers2

1

Maybe the prototype getStyle function is what you are looking for, even though it got some limitations. JQuery got the .css() method as meantioned in the answer to this question.

Community
  • 1
  • 1
user3154108
  • 1,264
  • 13
  • 23
0

The method visible() is working correct only for inline styles. Try instead:

$('your_element_id').getStyle('display')=='none'?0:1

to check if your element is visible or not.

Domus71

Domus71
  • 151
  • 1
  • 5