200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > html最小化位置不变 实现DIV相对于浏览器固定位置不变

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

时间:2022-04-29 12:32:36

相关推荐

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

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"

置左

置顶

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。