글 수 87
2006.09.14 10:31:45 (*.105.128.216)
17159
다음을 헤드나 바디에 넣으세요.
<script language="JavaScript">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
action = window.setInterval("heartBeat()",1);
function heartBeat() {
// combowidth=layer_right_bottom.offsetWidth
// comboheight=layer_right_bottom.offsetHeight
diffY = document.body.scrollTop;
diffX = 0;
if (diffY != lastScrollY) {
percent = .2 * (diffY - lastScrollY);
if (percent > 0) {
percent = Math.ceil(percent);
} else {
percent = Math.floor(percent);
}
document.all.layer_right.style.pixelTop += percent;
// document.all.layer_right_bottom.style.pixelTop = document.body.scrollTop+document.body.clientHeight-comboheight+percent-50;
lastScrollY = lastScrollY + percent;
}
if (diffX != lastScrollX) {
percent = .2 * (diffX - lastScrollX);
if (percent > 0) {
percent = Math.ceil(percent);
} else {
percent = Math.floor(percent);
}
document.all.layer_right.style.pixelLeft += percent;
// document.all.layer_right_bottom.style.pixelLeft += percent;
lastScrollY = lastScrollY + percent;
}
}
//-->
</script>
그리고 id=layer_right라는 이름의 레이어를
아래처럼 넣어주면 원하는 위치에 넣어주면 됩니다.
<div id="layer_right"></div>
<script language="JavaScript">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
action = window.setInterval("heartBeat()",1);
function heartBeat() {
// combowidth=layer_right_bottom.offsetWidth
// comboheight=layer_right_bottom.offsetHeight
diffY = document.body.scrollTop;
diffX = 0;
if (diffY != lastScrollY) {
percent = .2 * (diffY - lastScrollY);
if (percent > 0) {
percent = Math.ceil(percent);
} else {
percent = Math.floor(percent);
}
document.all.layer_right.style.pixelTop += percent;
// document.all.layer_right_bottom.style.pixelTop = document.body.scrollTop+document.body.clientHeight-comboheight+percent-50;
lastScrollY = lastScrollY + percent;
}
if (diffX != lastScrollX) {
percent = .2 * (diffX - lastScrollX);
if (percent > 0) {
percent = Math.ceil(percent);
} else {
percent = Math.floor(percent);
}
document.all.layer_right.style.pixelLeft += percent;
// document.all.layer_right_bottom.style.pixelLeft += percent;
lastScrollY = lastScrollY + percent;
}
}
//-->
</script>
그리고 id=layer_right라는 이름의 레이어를
아래처럼 넣어주면 원하는 위치에 넣어주면 됩니다.
<div id="layer_right"></div>