묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
스크롤바를 따라다니는 메뉴 질문입니다.
2002.08.02 09:21
여기 엔지오의 왼쪽 서브메뉴와 같이 스크롤바를 따라다니는 메뉴를 구현하기 위해 아래와 같이 했거든요?
그런데 메뉴의 움직임의 부드러움이 엔지오만큼 부드럽질 않네요.
여기에서 어디를 수정해야 하나요?
도무지 모르겠네요.
부탁드립니다.
<script language="JavaScript">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
if(IE) {
diffY = document.body.scrollTop;
diffX = 0;
}
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.MovingMenu.style.pixelTop += percent;
if(NS) document.MovingMenu.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.MovingMenu.style.pixelLeft += percent;
if(NS) document.MovingMenu.top += percent;
lastScrollY = lastScrollY + percent;
}
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
//-->
</script>
그런데 메뉴의 움직임의 부드러움이 엔지오만큼 부드럽질 않네요.
여기에서 어디를 수정해야 하나요?
도무지 모르겠네요.
부탁드립니다.
<script language="JavaScript">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
if(IE) {
diffY = document.body.scrollTop;
diffX = 0;
}
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.MovingMenu.style.pixelTop += percent;
if(NS) document.MovingMenu.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.MovingMenu.style.pixelLeft += percent;
if(NS) document.MovingMenu.top += percent;
lastScrollY = lastScrollY + percent;
}
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
//-->
</script>
댓글 3
-
베이쉬
2002.08.03 10:35
-
베이쉬
2002.08.03 10:36
<body></body> <-- ok? me no hangle.. T.T
<div id=floater style="left:0; top:0; width:??? ; height:???; z-index:10">all</div>
??? <-- image size Ok/? -
베이쉬
2002.08.03 10:37
sorry... me no hangle..
ec... T.T jul jul
<style type="text/css">
<!--
#floater {position:absolute; visibility:visible}
-->
</style>
<script language="JavaScript">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
if(IE) {
diffY = document.body.scrollTop;
diffX = 0;
}
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.floater.style.pixelTop += percent;
if(NS) document.floater.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.floater.style.pixelLeft += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
//-->
</script>