웹표준 퀵메뉴 > 웹디자인 Tip

본문 바로가기
 

웹표준 퀵메뉴

페이지 정보

작성자 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 9,468회 작성일 12-04-10 22:58

본문

--------Floating.js

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

function Floating(FloatingObj,MarginX,MarginY,Percentage,setTime) {
this.FloatingObj = FloatingObj;
this.MarginX = (MarginX) ? MarginX : 0;
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);
}

---------------------------




banner1


banner2




====================================

댓글목록

등록된 댓글이 없습니다.

Total 17건 1 페이지
웹디자인 Tip 목록
번호 제목 글쓴이 조회 날짜
17 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9506 07-16
16 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9253 07-16
15 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9754 07-16
14 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15437 07-16
13 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14050 09-03
12 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 10862 09-03
11 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15935 09-19
10 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 16307 06-17
9 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 16629 08-04
8 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15055 11-02
7 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 17431 12-02
6 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 16189 07-29
5 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15251 07-29
열람중 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9469 04-10
3 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 16708 04-10
2 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 9291 04-29
1 no_profile 휴먼 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15739 11-23
게시물 검색