<script type="text/javascript">
window.onscroll=function(){
var t=document.documentElement.scrollTop||document.body.scrollTop;
var div2=document.getElementById("apDiv");
if(t>= 105){
div2.style.position = "fixed";
div2.style.top = "0px";
}else{
div2.style.position = "absolute";
div2.style.top = "105px";
}
}
</script>
给div加上id=”apDiv” 就可以用了,网页下滑一定位置 左侧div固定显示
原文链接:https://www.um80.com/1910.htm,转载请注明出处。
评论0