js运动框架的问题
html====
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="style/main.css">
</head>
<body style="height:1000px">
<div id="box"></div>
</body>
</html>
<script src="js/jquery-1.11.2.js"></script>
<script src="js/demo.js"></script>
css
#box{width: 100px;height: 100px;background: red url() 0 0 no-repeat;position: absolute;bottom: 0;right: 0; }
js
window.onscroll=function () {
var obj=document.getElementById('box');
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
obj.style.top=document.documentElement.clientHeight-obj.offsetHeight+scrollTop+"px";
}
为什么我滚动一下图片就消失了,而视频是随着滚动的。我试了一下午了,请大婶指点指点
无聊来逛逛
9 years, 5 months ago