I got a question on my codes.
I use $(this).css('opacity') to check if an element is transparent or not. When the element is transparent, it should return 0.
However, if( $(this).css('opacity') !== 0 ) executes when it returns 0. Any idea why this happens?
Thanks in advance!
My codes is here:
This is because a CSS value is always returned as a string (unlike the
heightandwidthjQuery methods, which return a number).Try if this test works for you:
or simply use a weak (type-coercing) inequality: