Forum Moderators: not2easy

Message Too Old, No Replies

Position : fixed in ie6

is there a way to emulate position fixed in ie6?

         

vsgill

2:48 am on Jul 15, 2007 (gmt 0)

10+ Year Member



Hi Friends
i have the following div in my page whihc doesnt work in ie6

HTML

<div id="popup">my pop up text</div>

#popup{
z-index:13;
background-color:#333333;
position:fixed;
height:100%;
width:100%;
top:0px;
left:0px;
opacity: 0.40;
filter: alpha(opacity=40);
}

the div is suppose to popup on top of the page content when a button is clicked.

but problem is position:fixed does not work in IE6.
Is there a way i can get the same result in IE6 some how?
Any fix for position:fixed in IE6?
thank a lot again

Vik

DrDoc

2:57 am on Jul 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



May I recommend Dean Edwards' IE7 fix [dean.edwards.name]?
It fixes
position: fixed
and many other things for versions of IE 6 and older.

vsgill

3:20 am on Jul 15, 2007 (gmt 0)

10+ Year Member



Thanks for the reply DrDoc
I just checked the tool you recommended....
It looks like an awesome solution to so many problems but it is still in alpha version and is not recommended for commercial use..

Is there a CSS fix to this problem?

vsgill

3:29 am on Jul 15, 2007 (gmt 0)

10+ Year Member



I just tried this IE7 javascript fix...
works so good... this is awesome... but would it be practical you use it for a corporate website? becuase its in alpha stage...
Thanks
Vik

Marshall

3:49 am on Jul 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



vsgill,

I had the same problem and used the following fix. The CSS is straight off my page, so ignore what you don't need.

<style type="text/css"> /* The everyone else CSS */
#shadow {top:0px;width:200px;padding:5%;filter:shadow(color:gray, strength:10, direction:135); position:fixed; margin-left: 70%;}
</style>

<!--[if lte IE 6]>
<style type="text/css">
/*<![CDATA[*/
* html #shadow{ /*IE6 only rule, applied on top of the default above*/
position: absolute;
top: expression(document.compatMode=="CSS1Compat"? document.documentElement.scrollTop-40+"px" : body.scrollTop-40+"px");
}
/*]]>*/
</style>
<![endif]-->

It worked well for me.

Marshall

DrDoc

4:39 am on Jul 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



still in alpha version and is not recommended for commercial use

Meh. Ignore that. I have used it on several commercial sites, and it works great.
The quirks are few and obscure.

DrDoc

4:40 am on Jul 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey, Marshall. That's a neat solution too.
Does it jump at all? And, by the way, what's that "-40" for?

Marshall

5:09 am on Jul 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey, Marshall. That's a neat solution too.
Does it jump at all? And, by the way, what's that "-40" for?

It jumps a little. The minus forty (-40) was to offset the <div> as it was being pushed down too far and I was trying to flush it with the top of the window. I'm using it on a fixed menu which is rather long and I did not want the bottom cut off. It's a dimension that can be played with. Frankly, I'd like to put an announcement up that says "UPGRADE YOUR BROWSER", but that's tacky, IMHO. Generally though, I avoid things that aren't "browser friendly" without a fix - this is my one and only exception. (I hate doing all the "If" statements)

I do have another "fix" which is browser friendly, but the menu (in my case) would scroll up/down with the page then reappear in an absolute position. It's position is based on x/y of the window, similar to the patch above, but without any bounce.

Marshall