본문 바로가기

컴터/Javascript / html

[phpschool 펌]괜찮은 슬라이딩 메뉴

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head profile="http://www.w3.org/2000/08/w3c-synd/#">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="EditPlus" />
<meta name="keywords" content="Keywords" />
<meta name="description" content="Description" />
<title>Title</title>

<script type="text/javascript">
//----------------------------------------------
// Floating v1.1 Source By Bermann
// dobermann75@gmail.com
// Edited By ZnMee (2008-01-13)
// znmee@naver.com
//----------------------------------------------

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

function Floating ( FloatingObj , MarginY , TopLimit , Percentage , setTime ) {
 this.FloatingObj = FloatingObj;
 this.MarginY = (MarginY) ? MarginY : 0;
 this.TopLimit = (TopLimit) ? TopLimit : 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 () {
 this.Body = document.documentElement.scrollTop>document.body.scrollTop ? document.documentElement : document.body;
 var This = this;
 var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
 var DocTop = this.Body.scrollTop + this.MarginY;
 var MoveY = Math.abs(FloatingObjTop - DocTop);
 if ( DocTop>this.TopLimit ) {
  if ( FloatingObjTop < DocTop ) {
   this.FloatingObj.style.top = FloatingObjTop + Math.ceil( MoveY/this.Percentage ) + "px" ;
  } else {
   this.FloatingObj.style.top = FloatingObjTop - MoveY + "px" ;
  }
 } else {
   this.FloatingObj.style.top = this.TopLimit + "px" ;
 }
 window.clearTimeout(this.setTimeOut);
 this.setTimeOut = window.setTimeout( function () { This.Run(); } , this.setTime );
}
</script>

<style type="text/css">
#cTop { width: 650px; height: 20px; position: absolute; left: 100px; background-color: #f7f7f7; font: normal normal 12px/1.2 Gulim; color: 333533; }
#rTop { width: 100px; height: 20px; position: absolute; left: 750px; background-color: #e7e7e7; font: normal normal 12px/1.2 Gulim; color: 333533; }
</style>

</head>
<body>
<p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p><p>.<p>

<div id="cTop">중앙 레이어</div>
<div id="rTop">우측 레이어</div>
<script type="text/javascript">
new Floating(document.getElementById('cTop'),0,100,5,20);
new Floating(document.getElementById('rTop'),0,150,5,20);
</script>
</body>
</html>