5

I have tried to get the opacity to work in IE, I am testing in IE8 at the moment, Chrome etc works fine but IE8 is terrible.

My code has been:

$('#mydiv').animate({'opacity': '0.5'});

and

$('#mydiv').css('opacity', 0.5);

The opacity is applied to the images held within this div but none of the text, it's very infuriating :( can anyone help me? Thanks in advance.

1
  • 1
    I found fadeTo() a reliable cross browser way to animate opacity. api.jquery.com/fadeTo Commented Apr 13, 2012 at 9:25

5 Answers 5

5

try with this:

-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"; /* IE 8 */
filter: alpha(opacity=75); /* older IEs */

hope this is helpful for you

Sign up to request clarification or add additional context in comments.

Comments

4

$('#mydiv').fadeTo(0.5);

or

$('#mydiv').fadeTo(500,0.5);

or

$('#mydiv').fadeTo("slow",0.5);

http://api.jquery.com/fadeTo/

1 Comment

Your first suggestion wont work since speed is the first argument, but this seems to be the most correct solution here.
0

IE8 does'nt apply opacity to elements withoute a layout. See this answer Opacity CSS not working in IE8

Comments

0

jQuery handles setting the opacity in an IE ≥ 6 compatible way for you, both when using the css("opacity", value) and fade*() methods. But be sure to use the jQuery 1.x library which is compatible with IE 6, 7 and 8 as opposed to jQuery 2.x which is not (both are IE ≥ 9 compatible).

Here are the examples of using css("opacity", value) and fadeTo(duration, opacity):

However, there are issues in IE ≤ 8 related to opacity of semi-transparent PNGs: How to solve/hack fading semi-transparent PNG bug in IE8?

Comments

-1

Try this

filter: alpha(opacity=50);

instead of

opacity:0.5;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.