웹마스터 팁
page_full_width">
레이어를 원하는 곳에 고정하기입니다.
2002.11.14 14:00
간단한 레이어 고정하기 입니다.
<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>
<div id="layer_right" style="width:165px; height:347px; position:absolute; left:781px; top:100px; z-index:10; visibility:visible;">
<table border='0' cellpadding='0' cellspacing='1' width='165'>
<tr>
<td align='right' height='50'>
<p><a href='클릭시 이동할 주소' onfocus='this.blur()'><img src="원하는 그림" border='1' alt='날으는 돼지임당'></a></p>
</td>
</tr>
</table>
</div>
이동주소나 우너하는 그림이나 기타 내용을 유저분들이 넣으면 돼겠죠.
샘플은 아래주소를 클릭하세요.
http://diyworld.biz/test2.html
여기 자료실에 있는지 몰겠지만 아주 유용할것 같아 올립니다.
괜찮으면 추천한방,.^^
<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>
<div id="layer_right" style="width:165px; height:347px; position:absolute; left:781px; top:100px; z-index:10; visibility:visible;">
<table border='0' cellpadding='0' cellspacing='1' width='165'>
<tr>
<td align='right' height='50'>
<p><a href='클릭시 이동할 주소' onfocus='this.blur()'><img src="원하는 그림" border='1' alt='날으는 돼지임당'></a></p>
</td>
</tr>
</table>
</div>
이동주소나 우너하는 그림이나 기타 내용을 유저분들이 넣으면 돼겠죠.
샘플은 아래주소를 클릭하세요.
http://diyworld.biz/test2.html
여기 자료실에 있는지 몰겠지만 아주 유용할것 같아 올립니다.
괜찮으면 추천한방,.^^
댓글 7
-
아벨라
2002.11.17 02:25
-
뽀유★
2002.11.14 15:53
추천한방
원츄 ^ㅡ^ -
nantash
2002.11.16 15:17
속도조절가능하다면 어디에서 해야되죠? -
홍상제
2002.11.27 10:20
로그인 스킨에 적용해는데요 다른 기능들은 잘 되거든요.
그런데 로그인 스킨 위에 이미지 표시 나지 않는 사각이 하나 뜨구요
아래에 이상한거 하나 뜨거든요.
속성보면 이동할 주소라고 나오구요.
위에거는 마우스 오른쪽 눌러서 속성에 보면 아래와 같이 나와요.
http://www.book45.net/bbs/<p><!--%20로그인%20되었을때의%20화면입니다%20--><STYLE%20TYPE=
도데체 이거 뭐죠 어떻게 해야 제 기능할 수 있게 하죠. -
홍상제
2002.11.27 10:22
-
cocoroo
2004.01.25 02:24
잘되네요....감사합니다
이거 구하려고 한참 헤멨는데....
역시 인터넷은 좋은것이여~ -
이봉올
2005.04.29 18:14
정말 강츕니다~ Gooooooood!!
percent = .2 * (diffY - lastScrollY);
여기서 .2 보다 크면 클수룩 빠르고 .1 이면 느립니다.
만약 1.5로 하면 고정상태에서 레이어가 떨립니다.