웹마스터 팁

간단한 레이어 고정하기 입니다.



<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

여기 자료실에 있는지 몰겠지만 아주 유용할것 같아 올립니다.
괜찮으면 추천한방,.^^