플로팅 메뉴 (퀵메뉴)

조회 수 4680 추천 수 0 2010.01.06 13:19:11

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="content-type" content="text/html; charset=ecu-kr" />
<title>보짱넷::vozzang.net</title>
<script type="text/javascript">
//----------------------------------------------
//Floating v1.1 Source By Bermann
//dobermann75@gmail.com
//----------------------------------------------

//new Floating(적용할개체 , X축여백 , Y축여백 , 미끄러지는속도:작을수록빠름..기본20 , 빠르기:작을수록부드러움..기본10);

function Floating(FloatingObj,MarginX,MarginY,Percentage,setTime) {
    this.FloatingObj = FloatingObj;
    this.MarginX = (MarginX) ? MarginX : 900;
    this.MarginY = (MarginY) ? MarginY : 0;
    this.Percentage = (Percentage) ? Percentage : 20;
    this.setTime = (setTime) ? setTime : 10;
    this.FloatingObj.style.position = "absolute";
    this.Body = null;
    this.setTimeOut = null;
    this.Run();
}

Floating.prototype.Run = function () {
    if ((document.documentElement.scrollLeft + document.documentElement.scrollTop) > (document.body.scrollLeft + document.body.scrollTop)) {
        this.Body = document.documentElement;
    } else {
        this.Body = document.body;
    }

    var This = this;
    var FloatingObjLeft = (this.FloatingObj.style.left) ? parseInt(this.FloatingObj.style.left,10) : this.FloatingObj.offsetLeft;
    var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
    var DocLeft = this.Body.scrollLeft + this.MarginX;
    var DocTop = this.Body.scrollTop + this.MarginY;

    var MoveX = Math.abs(FloatingObjLeft - DocLeft);
    MoveX = Math.ceil(MoveX / this.Percentage);
    var MoveY = Math.abs(FloatingObjTop - DocTop);
    MoveY = Math.ceil(MoveY / this.Percentage);

    if (FloatingObjLeft < DocLeft) {
        this.FloatingObj.style.left = FloatingObjLeft + MoveX + "px";
    } else {
        this.FloatingObj.style.left = FloatingObjLeft - MoveX + "px";
    }

    if (FloatingObjTop < DocTop) {
        this.FloatingObj.style.top = FloatingObjTop + MoveY + "px";
    } else {
        this.FloatingObj.style.top = FloatingObjTop - MoveY + "px";
    }

    window.clearTimeout(this.setTimeOut);
    this.setTimeOut = window.setTimeout(function () { This.Run(); },this.setTime);
}
</script>

<style type="text/css">
body {height:800px;}
#quickmenu {position:absolute; top:100px; left:100px; width:90px;}
#quickmenu ul {width:90px; padding:5px 0 0 0;}
#quickmenu ul li {padding:5px 0 5px 0; text-align:center;}
</style>

</head>
<body>
<div id="quickmenu">
<ul>
<li><a href="#">메뉴</a></li>
<li><a href="#">메뉴</a></li>
<li><a href="#">메뉴</a></li>
<li><a href="#">메뉴</a></li>
<li><a href="#">메뉴</a></li>
</ul>
</div>

<script> 
//사용법 new Floating(적용할개체 , X축여백 , Y축여백 , 미끄러지는속도:작을수록빠름..기본20 , 빠르기:작을수록부드러움..기본10); 
new Floating(document.getElementById("quickmenu"),100,150,30,10); 
</script> 

</body>
</html>



출처는
Floating v1.1 Source By Bermann
dobermann75@gmail.com
입니다.

출처 url을 까먹었군요-_-;

profile

소속 : 밀짚모자 해적단

엮인글 :
http://www.vozzang.net/431/7a8/trackback
문서 첨부 제한 : 0Byte/ 2.00MB
파일 제한 크기 : 2.00MB (허용 확장자 : *.*)
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
16 크로스브라우징 가능한 폼 글자 수 계산 (트위터 처럼) id: 보짱보짱 2010-02-08 4746
15 png-hack (IE5.5~6에서 PNG이미지를 투명처리) [1] id: 보짱보짱 2010-02-02 4600
» 플로팅 메뉴 (퀵메뉴) id: 보짱보짱 2010-01-06 4680
13 이미지 탭 (Change Banner) id: 보짱보짱 2010-01-06 4442
12 FAQ 자주하는 질문 - 첫번째 항목 노출 버전 id: 보짱보짱 2010-01-06 4080
11 FAQ 자주하는 질문 id: 보짱보짱 2010-01-06 3478
10 DIV 배경 새로고침할때마다 랜덤으로 바꾸기 id: 보짱보짱 2010-01-06 3954
9 Multiple Image Viewer imagefile id: 보짱보짱 2010-01-06 3533
8 전체메뉴 보기 레이어 imagefile id: 보짱보짱 2010-01-06 4218
7 div나 table 등등을 슬라이드 id: 보짱보짱 2010-01-06 3778
6 기본 인쇄(프린트) 스크립트 id: 보짱보짱 2010-01-06 3676
5 창 닫기 스크립트 정리 id: 보짱보짱 2010-01-06 3810
4 익스플로러, 파이어폭스, 오페라 즐겨찾기 추가 id: 보짱보짱 2010-01-06 3793
3 쿠키 레이어 팝업 id: 보짱보짱 2010-01-06 3729
2 Lightbox Plus file id: 보짱보짱 2010-01-06 3599
1 초간단 롤오버 이미지 id: 보짱보짱 2010-01-06 3669
XE Login