Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    44
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Opacity not working: IE8 vs IE7: seem to care about position style

    I have found that in IE8 I cannot give an element the alpha filter (opacity) if it has the position style set to something (relative or absolute). An element without the position style (it is the empty string) can have opacity in IE8.

    I have found that in IE7 I can only give an element the alpha filter if the position style is set to something (relative or absolute). An element without a position style will not take the alpha filter.

    This is a major conundrum. Does anyone have any insight into this bug? Given the above, I can only achieve opacity in one of the two browsers.

    I have both IE8 and IE7 running in standards mode.

    The opacity is being set programmatically with JS like so:
    obj.style.filter = "alpha(opacity="+opacity+")";
    where opacity is an integer between 0 and 100.

    Obviously I don't have any problem with any other browser doing opacity because it is different styles for them and they don't care about the position style at all.
    Last edited by Skychan; 02-18-2010 at 06:16 AM.

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    44
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Turns out that IE is supposed to require the element to be positioned (for the alpha filter to be applied), so I don't know why IE8 won't do it for me on elements that are positioned. Thankfully there is a hack to make it work in IE7, which wants the element to be positioned: simply set the zoom style to 1.

    obj.style.zoom = 1;

    Cake.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •