레이어 스부적스부적 이동 스크립트

· 17년 전 · 1287
<script> /* // // 레이어 스부적스부적 이동 스크립트. // // by hanulis(hanulis@gmail.com). 2007. // // usage: mino.layer.moveSmooth(obj,x,y); // // 설명: obj를 x,y 위치로 스부적 이동시킴. obj의 style중 position:absolute가 추가되어있어야 합니다. // // 예제: <div id="test" style="position:absolute">aaa</div> // <script>mino.layer.moveSmooth(document.getElementById("test"),200,400); </ script> // // 보너스: x혹은 y축만 움직이고 싶을때, 움직이지 않을축을 null로 지정합니다. // // 예제: <script>mino.layer.moveSmooth(document.getElementById("test"),null,400); </ script> // */ var mino={} var _mino_layer_smooth_obj=null; var _mino_layer_smooth_doing=false; mino.layer={ xy:function(obj) { if(document.getBoxObjectFor) { //firefox try { var tempXY=document.getBoxObjectFor(obj); } catch(e) {return [0,0,obj.offsetWidth,obj.offsetHeight]} return [tempXY.x,tempXY.y,obj.offsetWidth,obj.offsetHeight]; } else if(obj.getBoundingClientRect) { //internet Explorer var tempXY=obj.getBoundingClientRect(); return [(tempXY.left+document.body.scrollLeft),(tempXY.top+document.body.scrollTop),obj.offsetWidth,obj.offsetHeight]; } else return false; }, moveSmooth:function(obj,x,y) { if(!_mino_layer_smooth_obj) _mino_layer_smooth_obj=obj; if(arguments[3]==undefined && _mino_layer_smooth_doing) { return; } else _mino_layer_smooth_doing=1; var loc=mino.layer.xy(_mino_layer_smooth_obj); if(x!=null) { if(Math.abs(Math.abs(loc[0])-Math.abs(x))<10) { obj.style.left=x; var xc=1; } else { obj.style.left=parseInt(loc[0]+(x-loc[0])/3); } } else var xc=1; if(y!=null) { if(Math.abs(Math.abs(loc[1])-Math.abs(y))<10) { obj.style.top=y; var yc=1; } else { obj.style.top=parseInt(loc[1]+(y-loc[1])/3); } } else var yc=1; if(xc && yc) { _mino_layer_smooth_doing=0; _mino_layer_smooth_obj=null; return; } setTimeout('mino.layer.moveSmooth(_mino_layer_smooth_obj,'+x+','+y+',"s")',10); } } </script> <div id="k" style="background-color:#eeffe0;position:absolute;width:200;height:200;border:1px solid #000000"></div> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <input type=button value="move(0,0)" onclick="mino.layer.moveSmooth(document.getElementById('k'),0,0)"> <input type=button value="move(-200,-200)" onclick="mino.layer.moveSmooth(document.getElementById('k'),-200,-200)"> <input type=button value="move(400,400)" onclick="mino.layer.moveSmooth(document.getElementById('k'),400,400)"> <input type=button value="move(300,300)" onclick="mino.layer.moveSmooth(document.getElementById('k'),300,300)"> <input type=button value="move(500,null)" onclick="mino.layer.moveSmooth(document.getElementById('k'),500,null)"> <input type=button value="move(null,500)" onclick="mino.layer.moveSmooth(document.getElementById('k'),null,500)">
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
17년 전 조회 1,410
17년 전 조회 2,243
17년 전 조회 1,967
17년 전 조회 2,282
17년 전 조회 2,804
17년 전 조회 3,258
17년 전 조회 2,356
17년 전 조회 1,627
17년 전 조회 3,198
17년 전 조회 3,064
17년 전 조회 3,040
17년 전 조회 3,907
17년 전 조회 2,580
17년 전 조회 2,401
17년 전 조회 2,651
17년 전 조회 2,888
17년 전 조회 2,606
17년 전 조회 1,447
17년 전 조회 1,890
17년 전 조회 1,484
17년 전 조회 1,907
17년 전 조회 2,503
17년 전 조회 8,689
17년 전 조회 3,149
17년 전 조회 4,237
17년 전 조회 1,979
17년 전 조회 3,654
17년 전 조회 1,547
17년 전 조회 1,380
17년 전 조회 2,318
17년 전 조회 1,310
17년 전 조회 1,623
17년 전 조회 1,454
17년 전 조회 2,523
17년 전 조회 1,491
17년 전 조회 1,084
17년 전 조회 1,217
17년 전 조회 3,094
17년 전 조회 2,158
17년 전 조회 1,965
17년 전 조회 1,209
17년 전 조회 2,442
17년 전 조회 1,166
17년 전 조회 1,124
17년 전 조회 1,364
17년 전 조회 2,728
17년 전 조회 2,385
17년 전 조회 2,471
17년 전 조회 1,173
17년 전 조회 1,288
17년 전 조회 3,237
17년 전 조회 2,823
17년 전 조회 4,089
17년 전 조회 2,249
17년 전 조회 2,345
17년 전 조회 1,395
17년 전 조회 2,514
17년 전 조회 2,201
17년 전 조회 2,959
17년 전 조회 2,468
17년 전 조회 1,632
17년 전 조회 2,425
17년 전 조회 1,583
17년 전 조회 1,173
17년 전 조회 2,232
17년 전 조회 2,878
17년 전 조회 4,053
17년 전 조회 3,143
17년 전 조회 1,409
17년 전 조회 1,706
17년 전 조회 2,239
17년 전 조회 1,543
17년 전 조회 1,716
17년 전 조회 2,710
17년 전 조회 2,134
17년 전 조회 1,787
17년 전 조회 4,191
17년 전 조회 3,039
17년 전 조회 1,429
17년 전 조회 3,562
17년 전 조회 2,793
17년 전 조회 2,074
17년 전 조회 1,290
17년 전 조회 2,324
17년 전 조회 2,064
17년 전 조회 1,977
17년 전 조회 1,919
17년 전 조회 1,170
17년 전 조회 1,874
17년 전 조회 2,928
17년 전 조회 1,430
17년 전 조회 1,670
17년 전 조회 1,351
17년 전 조회 1,599
17년 전 조회 1,571
17년 전 조회 1,444
17년 전 조회 2,556
17년 전 조회 2,319
17년 전 조회 2,102
17년 전 조회 1,411
🐛 버그신고