浏览器最小化后不见了,html最小化位置不变,实现DIV相对于浏览器固定位置不变

 2023-09-28 阅读 18 评论 0

摘要:Anchor Propertiesfunction top(){window.scrollTo(0,0);}function bottom(){//scrollHeight属性是获取对象的滚动高度。window.scrollTo(0,document.body.scrollHeight);}function left(){//alert("left");alert(document.body.scrollLeft)var left = 0-document
Anchor Properties

function top(){

window.scrollTo(0,0);

}

function bottom(){

//scrollHeight属性是获取对象的滚动高度。

window.scrollTo(0,document.body.scrollHeight);

}

function left(){

//alert("left");alert(document.body.scrollLeft)

var left = 0-document.body.scrollWidth;//向左移动的像素

window.scrollBy(left,0 );

}

function right(){

//alert(document.body.scrollWidth);

//整个滚动条的宽度

window.scrollBy(document.body.scrollWidth,0);

}

function init(){

var init_pos=oLayer.style.posTop ;

var init_left=oLayer.style.posLeft;

document.body.οnscrοll=function(){

//document.body.scrollTop等于滚动滑块上端离滚动的开始点的距离

oLayer.style.posTop=document.body.scrollTop+init_pos;

//scrollLeft设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离

oLayer.style.posLeft=document.body.scrollLeft +init_left;

}

}

置底

ddddd

置 右

width="2000px"

置 左

置 顶

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/102609.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息