Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2010, 06:09 AM   PM User | #1
Skychan
New Coder

 
Join Date: Feb 2010
Posts: 44
Thanks: 0
Thanked 3 Times in 3 Posts
Skychan is an unknown quantity at this point
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..
Skychan is offline   Reply With Quote
Old 02-18-2010, 06:15 AM   PM User | #2
Skychan
New Coder

 
Join Date: Feb 2010
Posts: 44
Thanks: 0
Thanked 3 Times in 3 Posts
Skychan is an unknown quantity at this point
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.
Skychan is offline   Reply With Quote
Reply

Bookmarks

Tags
bug, ie7, ie8, opacity, position

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 PM.


Advertisement
Log in to turn off these ads.