Document
css*{margin: 0;padding: 0;} #box{width: 100px;height: 100px;background: red;position: absolute;right: 0;bottom: 0;}
window.onscroll=function () {
var box=document.getElementById('box');
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
box.style.top=document.documentElement.clientHeight-box.offsetHeight+scrollTop+"px";
}
在body里面
为什么不会动而出错了。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
http://www.zhangxinxu.com/wordpress/?p=4772
请先注意提问的格式。
script放在body里试试?