Scroll.js用于#bird块,它遵循页面滚动。
主要的问题是,如果我移除Doctype行,它是工作的,这个行:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">如果doctype是开的,它就不能工作.
以下是html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="jquery.js" type="text/javascript"></script>
<script src="scroll.js" type="text/javascript"></script>
</head>
<body>
<div style="position:relative; height:20000px">
<div id="bird" style="position:absolute;left:0;top:20px;width:200px"></div>
</div>
</body>
</html>和js:
去除
不要要求删除文档类型,它的需要.
发布于 2009-05-04 20:58:05
你需要替换这个:
document.body.scrollTop在这方面:
document.documentElement.scrollTopscrollTop属于标准模式下的<html>元素,而不是<body>元素。
(请注意,document.body.scrollTop在代码中出现了三次。)
发布于 2009-05-04 20:52:45
有一个问题在你的鸟div,样式有宽度:200“,应该是宽度:200 be”(加上单位)
https://stackoverflow.com/questions/821992
复制相似问题