站长资源
中国站长网站

让ie6,ie7,ie8完美支持position:fixed

ie6对position:fixed不支持,网上有很多解决方法,有的在ie6,ie7上调试成功后,在ie8上又不好使,p层还是跟随滚动条浮 动;以下总结方法,在ie6,ie7,ie8上都调试成功,且页面滚动条滚动时,效果还挺好,p层并不会闪烁。

代码如下:html部分

<p id="goTop_p" class="fixed ie"> </p>

css部分:

.fixed{ 
position:fixed; /*对于火狐等其他浏览器需要设置的*/ 
top:700px; /*同上*/ 
width:30px; 
height:30px; 
cursor:pointer; 
display:none; 
} 
.ie{ 
_position: absolute; 
_clear: both; 
_top:expression(eval(document.compatMode && 
document.compatMode=='CSS1Compat') ? 
documentElement.scrollTop 
+(documentElement.clientHeight-this.clientHeight) - 1 
: document.body.scrollTop 
+(document.body.clientHeight-this.clientHeight) - 1); 
}

本文出处:来自互联网信息共享,请勿相信收费信息站长资源 » 让ie6,ie7,ie8完美支持position:fixed

评论 抢沙发

评论前必须登录!