사이트 내 전체검색
스크롤을 따라 움직이는 레이어
https://cmd.kr/javascript/246 URL이 복사되었습니다.

본문

<HTML>
<HEAD>
<script language="JavaScript">
var StartPos=50; // 처음 위쪽 여백
var MovePos=10; // 스크롤 될때 위쪽 여백
var MaxHeight

function InitMove() {
rtmenu.style.top = document.body.scrollTop + StartPos;
MaxHeight = document.body.scrollHeight;
MoveMenu();
}

function MoveMenu() {
var yBannerPos, yScrollTopPos
var yLimitPos
var interval
var yNewPos
var SetValue

yScrollTopPos = parseInt(document.body.scrollTop,10);
yBannerPos = parseInt(rtmenu.style.top, 10);

if( document.body.scrollTop < StartPos )
yLimitPos = StartPos ;
else
yLimitPos = document.body.scrollTop + MovePos ;

if (yBannerPos != yLimitPos){
yNewPos = Math.ceil(Math.abs(yLimitPos - yBannerPos)/20); //반올림
if(yLimitPos < yBannerPos){
yNewPos = -yNewPos;
}

SetValue = parseInt(rtmenu.style.top, 10) + yNewPos;

if (SetValue > MaxHeight )
rtmenu.style.top = MaxHeight;
else
rtmenu.style.top = SetValue;
}
setTimeout ("MoveMenu()",10)
}
</script>
</HEAD>

<BODY onload=InitMove()>

<table align=center width=400 cellpadding=0 cellspacing=0 border=0>
<tr>
<td align=right>
<div id="rtmenu" style="position:absolute;z-index:1">
<table width=160 border=3 algin=center cellpadding=3 cellspacing=0 style="border:3 solid #BFBFFF;">
<tr>
<td>스크롤을 따라 움직일 내용<iframe src="웹페이지 주소" width=150 height=177 frameborder=no scrolling=no></iframe> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>

</BODY>
</HTML>

출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=58

댓글목록

등록된 댓글이 없습니다.

831 (10/17P)

Search

Copyright © Cmd 명령어 3.129.195.254