求个效果,有演示。

todown 2011-06-08 11:35:15
http://comment.news.163.com/news3_bbs/75VFJ4MS00014JB6.html

右边那个随下拉条固定不变的效果。当下拉条下拉到一定高度时那个DIV变浮动。
...全文
85 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zell419 2011-06-08
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>zell419</title>
<style type="text/css">
#right{position:fixed;_position:absolute;top:0px;_top:0px;right:100px;_right:100px; _margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)}
</style>
</head>
<body style="height:5000px;">
<div id="right"># right </div>
</body>
</html>

这样 ?
自己去通过left top left bottom 调整具体为主 。
kk297173176 2011-06-08
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../demo/jquery-1.3.2.min.js" type="text/javascript"></script>
</head>
<body style="height:2800px;">
*DIV开始固定在一个位置,当下拉条下拉的高度超过这个DIV 1px的时候,这个DIV变浮动*
<div id="top" style="position:fixed; top:50px; left:50px;">

</div>
<div id="pan" style="width:160px; height:300px; border:dashed 1px black; position:absolute; right:0px; top:300px;">

</div>
<script type="text/javascript">
$(document).ready(function () {
window.onscroll = function () {
var t = document.documentElement.scrollTop;
document.getElementById("top").innerHTML = t;

if (t > 301) {
$("#pan").css({ "position": "fixed", "top": "0" });
}
else {
$("#pan").css({ "position": "absolute", "top": "300" });
}

}
});
</script>
</body>
</html>

todown 2011-06-08
  • 打赏
  • 举报
回复
不是这样的,你这个是默认浮动的,我要的是DIV开始固定在一个位置,当下拉条下拉的高度超过这个DIV 1px的时候,这个DIV变浮动。
要用JS来写的,监控IE下拉条触发事件。大体原理我知道,但不知道怎么写。

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧