31
Tips #2: Animating opacity with jQuery? Don’t forget to set your opacity before animating
Animating opacity with jQuery can be a little tricky. If you look closely, the first opacity animation might not happen. You would think that $(‘element’).animating({opacity:0}) would do the trick, but actually that is not really the case. When you animate opacity always remember to set the default opacity before, in CSS you can add opacity:0 to your element.
However, if you remember, Internet Explorer 6 and 7 do not support CSS opacity, they support the weird, IE only, filter:alpha(opacity=70). Unfortunately for us, that will not do the trick and the first opacity animation will not happen.
So there is only one cross browser way to do this that I know, in your DOM ready, add $(‘element’).css(“opacity”, 0).
Hope it helps!
1 Comment to “Tips #2: Animating opacity with jQuery? Don’t forget to set your opacity before animating”
Leave a comment
Articles
Some Tweets
- good day today, did an autocomplete widget that use the binary algorithm in pure JS,
- doing a pure js widget.. it's like going back 5 years ago
- Inspire the web with just 10K. A competition from ALA http://10k.aneventapart.com/
- binary search rock large javascript array
- Photoshop just crashed on me, been a while...
- Introduction to the Google WebFont Loader and how to avoid @font-face text flickering with it http://bit.ly/at8Pus









thank you very much for this. it solved my problem in stupid ie6