CSS Code:
#btn{
background: url(transparent.png) no-repeat;
filter: alpha(opacity=0);
-moz-opacity: 0;
-khtml-opacity: 0;
opacity: 0;
}
JavaScript/jQuery:
$("#btn").animate({opacity:1,"margin-left":"-25px"});
I don't have any problem with the code above on Firefox, Chrome and others. But it does not work on any version of Internet Explorer.
The problem is the PNG image is rendered strange, background of the transparent PNG looks black. When I remove opacity effect, there is no problem.
What is the solution?
For me it worked to just include the filter property with blank value in jQuery's .animate()function
Maybe this will work for you, too.
$("#btn").animate({opacity:1,"margin-left":"-25px", filter:''});
Additionally you might have to remove the filter property from your button's CSS.
filter:''
hack does not work with current jQuery (1.6.1) anymore
There is currently no solution for this that I'm aware of. Just have to wait for IE to catch up with the rest of the world. I had to abandon such a feature in a recent project just days ago. You unfortunately cannot have a feathered-edge PNG with IE fading in and out with jQuery.
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