How can I change the alpha of an image in javascript? Also, what browsers support this?
Using jQuery:
$(something).css('opacity', 0.5);
This will work in every browser.
However, it will not work properly with semi-transparent PNG images in IE 7 and 8 unless they are applied using a filter.
I don't think you can change the alpha of the image itself, but you can change it from the tag, or the container in which you put it.
The particular css properties I use for this are :
filter:alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
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