How do I check if the opacity of an element is 0, and then do something in jQuery?
jQuery Effect fadeTo() MethodThe fadeTo() method gradually changes the opacity, for selected elements, to a specified opacity (fading effect).
jQuery | fadeTo() with Examples The fadeTo() is an inbuilt method in jQuery which is used to change the opacity of the selected element. Here selector is the selected element. speed: It specifies the speed of the fading effect. opacity: It specifies to fade and this value should must be in between 0.0 and 1.0.
Definition and UsageThe opacity property sets or returns the opacity level of an element. The opacity-level of an element describes the transparency-level, where 1 is not transperant at all, 0.5 is 50% see-through, and 0 is completely transparent.
Have you tried using .css()?
if($('elemFoo').css('opacity') == 0) { doSomething(); }
You can do as
$(function() { if ($('#foo').css('opacity') == 0) alert('lol'); });
Demo : http://jsfiddle.net/9GEZ5/
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