jQuery applying css opacity

36,539

Solution 1

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

Solution 2

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

or

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

or

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

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

Share:
36,539
green_arrow
Author by

green_arrow

Updated on July 09, 2022

Comments

  • green_arrow
    green_arrow almost 2 years

    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.

  • Andrew Magill
    Andrew Magill about 11 years
    Your first suggestion wont work since speed is the first argument, but this seems to be the most correct solution here.