화면 스크롤시 같이 스크롤 되는 메뉴 자바스크립트

Author : 금봉이 / Date : 2008.10.19 15:17 / Category : 관심꺼리.log/스크랩.dbf

<script type="text/javascript">  
    <!-- 
        var stmnLEFT = 700; // 왼쪽 여백 (메뉴가 왼쪽에서 720픽셀 떨어진 곳에 보여집니다) 
        var stmnGAP1 = 200; // 위쪽 여백 (메뉴가 위에서 500픽셀 떨어진 곳에 보여집니다) 
        var stmnGAP2 = 200; // 스크롤시 브라우저 위쪽과 떨어지는 거리 
        var stmnBASE = -20; // 스크롤 시작위치 
        var stmnActivateSpeed = 5; 
        var stmnScrollSpeed = 5; 

        var stmnTimer; 

        function RefreshStaticMenu() { 
            var stmnStartPoint, stmnEndPoint; 
            stmnStartPoint = parseInt(document.getElementById('STATICMENU').style.top, 10); 
            stmnEndPoint = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + stmnGAP2; 
            if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1; 
            if (stmnStartPoint != stmnEndPoint) { 
                stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 ); 
                document.getElementById('STATICMENU').style.top = parseInt(document.getElementById('STATICMENU').style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ) + 'px'; 
                stmnRefreshTimer = stmnScrollSpeed; 
            } 
            stmnTimer = setTimeout("RefreshStaticMenu();", stmnActivateSpeed); 
        } 

        function InitializeStaticMenu() { 
            document.getElementById('STATICMENU').style.display = 'block'; 
            document.getElementById('STATICMENU').style.left = stmnLEFT + 'px'; 
            document.getElementById('STATICMENU').style.top = document.body.scrollTop + stmnBASE + 'px'; 
            RefreshStaticMenu(); 
        } 
    //--> 
</script>

…

<body onload="InitializeStaticMenu();">
신고

Tags : , , ,

Trackbacks 0 / Comments 0

Blog Information

금봉이

Calendar

«   2017/08   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Copyright © 관심꺼리.log All Rights Reserved
Designed by CMSFactory.NET