IE6 pisition:fixed does not work, floating window does not roll with the screen solution

Source: Internet
Author: User
Tags eval

According to the instructions on the web, the following CSS in the _top does not seem to play a role.

The code is as follows Copy Code

. jumpbox{
Position:absolute;
margin-left:-288px;
left:50%;
/*margin-top:-122px;*/
_margin-top:0px;
top:33%;
width:576px;
z-index:9999;
Position:fixed!important;/*ff ie7*/
position:absolute;/*ie6*/
Display:none;

_top:expression (eval (Document.compatmode &&
document.compatmode== ' Css1compat ')?
Documentelement.scrolltop + (Document.documentelement.clientheight-this.offsetheight)/2:/*IE6*/
Document.body.scrollTop + (Document.body.clientheight–this.clientheight)/2);/*IE5 ie5.5*/
}

Then Baidu a bit

Add a property

The code is as follows Copy Code
_top:expression (eval (document.documentElement.scrollTop));

It's OK!

Use IE's specially supported CSS expressions and position:absolute to solve this bug perfectly.

PS. The above method also needs to include the following attributes in HTML:

The code is as follows Copy Code

Background-image:url (About:blank);
background-attachment:fixed;

Finally, let's sort it out.


1, IE6 under the position:fixed setting

#bot-fixed{position:fixed;_postion:absolute;bottom:0;_bottom:auto;right:20px;_top:expression (eval ( Document.documentelement.scrolltop+document.documentelement.clientheight-this.offsetheight-(ParseInt ( this.currentstyle.margintop,10) | | 0)-(parseint (this.currentstyle.marginbottom,10) | | 0));}

2, element fixed at the top of the browser and the bottom set method (for IE6)

A: The elements are fixed at the top of the browser:

The code is as follows Copy Code

#bot-fixed{_position:absolute;_bottom:auto;_top:expression (eval (document.documentElement.scrollTop));

B: The elements are fixed at the bottom of the browser:

The code is as follows Copy Code

#bot-fixed{_position:absolute;_bottom:auto;_top:expression (eval (document.documentelement.scrolltop+ document.documentelement.clientheight-this.offsetheight-(parseint (this.currentstyle.margintop,10) | | 0)-(parseint (this.currentstyle.marginbottom,10) | | 0));}

3, to solve the position:fixed layer flashing method

Adding in CSS style sheets

The code is as follows Copy Code
*html{Background-image:url (About:blank); background-attachment:fixed;}

Property


We can also use JS to solve some problems.

  code is as follows copy code

G1 = (Getclientheight () –o.height)/2;//1000px total element height 300px g1=350px
g2 = G1 /Getclientheight ();//350/1000 = 0.35
G2 = math.round (G2 * 100) –1;//=34 four to five into greater than five all plus, equal to five positive plus, less than five total.
$ ('. Jumpbox '). CSS (' top ', G2 + '% ');
$ ('. Jumpbox '). CSS (' height ', document.body.scrollHeight);
if ($.browser.msie && $.browser.version = "6.0″) {
default_top1=document.documentelement.scrolltop+ 150+ "px";
$ ('. Jumpbox '). CSS ("top", DEFAULT_TOP1);
$ (window). Scroll (function () {
default_top2=document.documentelement.scrolltop+150+ "px";
$ ('. Jumpbox ') . CSS ("top", default_top2);

})

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.