当前位置: 技术问答>java相关
我是jsp的新手,请问如何实现在页面中增加一个随着页面滚动的小页面????
来源: 互联网 发布时间:2015-09-25
本文导语: 同上 | self.onError = null; currentX = currentY = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = (document.layers) ? 1 : 0; IE = (document.all) ? 1: 0; function heartBeat() {...
同上
|
self.onError = null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat()
{
if(IE) {
diffY = document.body.scrollTop; diffX = document.body.scrollLeft;
}
if(NS) {
diffY = self.pageYOffset; diffX = self.pageXOffset;
}
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.LayerTree.style.pixelTop += percent;
if(NS) document.LayerTree.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.LayerTree.style.pixelLeft += percent;
if(NS) document.LayerTree.left += percent;
lastScrollX = lastScrollX + percent;
}
}
function checkFocus(x,y)
{
stalkerx = document.LayerTree.pageX;
stalkery = document.LayerTree.pageY;
stalkerwidth = document.LayerTree.clip.width;
stalkerheight = document.LayerTree.clip.height;
if( (x > stalkerx && x stalkery && y