怎么让一些网页内的数据跟随浏览器动 如淘宝的宝贝详情那一栏导航,当浏览器浏览过那里的时候那个工具栏就会在浏览器上置顶,在浏览回去的时候他还能再原位,还有在淘宝搜索的时候那个搜索条件那里,也是可以跟着浏览器置顶移动的。。这种效果怎么实现呢???不知道的可以去淘宝看下,现在这项技术不止淘宝,还有去哪儿也有,很多地方都用到了。而且兼容很多浏览器额,求知道,求真相 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用css的position:fixed但是IE6没有这个属性,用JS判断 以下是非ie6的属性{ width:130px; position:fixed; bottom:26px; right:50px; height:50px;}以下是ie6的属性 { width:130px; right:50px; top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)-26));/*这里的26是距离底部的像素值*/} <div class="abc"></div>.abc{ width:360px; height:142px; opacity:1.5;/*FF*/ z-index:1000000000; //这个是层级,设置他为最上层 position:fixed!important;/*FF IE7*/ //这个是跟着屏幕走的,火狐,IE6以上通用 position:absolute;/*IE6*/ //这个是让他随屏幕走的! _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*/ left:500px; top:300px; background-color:White; border:3px solid #666464;} 试了下。。貌似没反应啊。。谷歌,IE6,IE8下都试了。。 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script><script type="text/javascript"> $(document).ready(function() { var targetTop=$("#target").offset().top; $(window).scroll(function(){ var wscrollTop=$(window).scrollTop(); if(wscrollTop>targetTop) { $("#target").animate({"top":wscrollTop+100},100); } else { $("#target").animate({"top":targetTop},100); } }) });</script></head><body style="height:900px; background-color:Gray"> <div id="target" style="width:400px; height:300px; border:1px solid red;left:200px;top:100px; position:absolute"> 3213123 </div> </body></html> 关于checkbox的选中的问题 使用jQuery的$.get方法远程请求返回值问题。现在不能返回。 如何生成调用其他网站制定栏目标题和链接的js文件 cookie 导致页面无法加载,高手有遇到过不? 问个简单的问题,return语句该如何使用 Google Map 放大缩小平移 100分 正则替换多个匹配的问题 大家帮忙,小第求救 我用XMLHTTP在客户端下载网页时,老是出现一个提示框,能不能把这个框去掉?50分 作javascript要用到工具吗?比如visual javascript url重写 IIS 配置 文件是否存在 div层显示所有框架之上(frameset frame)
但是IE6没有这个属性,用JS判断
{
width:130px;
position:fixed;
bottom:26px;
right:50px;
height:50px;
}
以下是ie6的属性
{
width:130px;
right:50px;
top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)-26));/*这里的26是距离底部的像素值*/
}
<div class="abc"></div>
.abc
{
width:360px;
height:142px;
opacity:1.5;/*FF*/
z-index:1000000000; //这个是层级,设置他为最上层
position:fixed!important;/*FF IE7*/ //这个是跟着屏幕走的,火狐,IE6以上通用
position:absolute;/*IE6*/ //这个是让他随屏幕走的!
_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*/
left:500px;
top:300px;
background-color:White;
border:3px solid #666464;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function()
{
var targetTop=$("#target").offset().top;
$(window).scroll(function(){
var wscrollTop=$(window).scrollTop();
if(wscrollTop>targetTop)
{
$("#target").animate({"top":wscrollTop+100},100);
}
else
{
$("#target").animate({"top":targetTop},100);
}
})
});
</script>
</head><body style="height:900px; background-color:Gray">
<div id="target" style="width:400px; height:300px; border:1px solid red;left:200px;top:100px; position:absolute">
3213123
</div>
</body>
</html>