html====
Document
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";
}
为什么我滚动一下图片就消失了,而视频是随着滚动的
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
使用
jQuery的写法:$('#box').animate({'top': documentElement.clientHeight - obj.height() + scrollTop + 'px'}, 'slow');html 文件头部添加
<!DOCTYPE html>声明