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

· 17년 전 · 1290
<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,414
17년 전 조회 2,247
17년 전 조회 1,970
17년 전 조회 2,285
17년 전 조회 2,807
17년 전 조회 3,260
17년 전 조회 2,359
17년 전 조회 1,629
17년 전 조회 3,200
17년 전 조회 3,065
17년 전 조회 3,040
17년 전 조회 3,909
17년 전 조회 2,582
17년 전 조회 2,402
17년 전 조회 2,652
17년 전 조회 2,890
17년 전 조회 2,606
17년 전 조회 1,449
17년 전 조회 1,892
17년 전 조회 1,485
17년 전 조회 1,909
17년 전 조회 2,507
17년 전 조회 8,690
17년 전 조회 3,149
17년 전 조회 4,238
17년 전 조회 1,980
17년 전 조회 3,655
17년 전 조회 1,550
17년 전 조회 1,383
17년 전 조회 2,318
17년 전 조회 1,311
17년 전 조회 1,624
17년 전 조회 1,457
17년 전 조회 2,524
17년 전 조회 1,494
17년 전 조회 1,085
17년 전 조회 1,220
17년 전 조회 3,095
17년 전 조회 2,159
17년 전 조회 1,967
17년 전 조회 1,211
17년 전 조회 2,446
17년 전 조회 1,167
17년 전 조회 1,125
17년 전 조회 1,367
17년 전 조회 2,733
17년 전 조회 2,390
17년 전 조회 2,474
17년 전 조회 1,175
17년 전 조회 1,291
17년 전 조회 3,240
17년 전 조회 2,826
17년 전 조회 4,093
17년 전 조회 2,255
17년 전 조회 2,348
17년 전 조회 1,398
17년 전 조회 2,517
17년 전 조회 2,205
17년 전 조회 2,964
17년 전 조회 2,473
17년 전 조회 1,635
17년 전 조회 2,428
17년 전 조회 1,586
17년 전 조회 1,173
17년 전 조회 2,234
17년 전 조회 2,878
17년 전 조회 4,055
17년 전 조회 3,144
17년 전 조회 1,411
17년 전 조회 1,706
17년 전 조회 2,241
17년 전 조회 1,547
17년 전 조회 1,719
17년 전 조회 2,714
17년 전 조회 2,136
17년 전 조회 1,791
17년 전 조회 4,194
17년 전 조회 3,043
17년 전 조회 1,434
17년 전 조회 3,565
17년 전 조회 2,796
17년 전 조회 2,076
17년 전 조회 1,292
17년 전 조회 2,326
17년 전 조회 2,065
17년 전 조회 1,977
17년 전 조회 1,921
17년 전 조회 1,172
17년 전 조회 1,875
17년 전 조회 2,930
17년 전 조회 1,431
17년 전 조회 1,672
17년 전 조회 1,352
17년 전 조회 1,600
17년 전 조회 1,573
17년 전 조회 1,446
17년 전 조회 2,559
17년 전 조회 2,324
17년 전 조회 2,103
17년 전 조회 1,413
🐛 버그신고