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

· 17년 전 · 1430
<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,571
17년 전 조회 2,384
17년 전 조회 2,130
17년 전 조회 2,426
17년 전 조회 2,960
17년 전 조회 3,438
17년 전 조회 2,526
17년 전 조회 1,790
17년 전 조회 3,374
17년 전 조회 3,227
17년 전 조회 3,204
17년 전 조회 4,069
17년 전 조회 2,719
17년 전 조회 2,560
17년 전 조회 2,819
17년 전 조회 3,057
17년 전 조회 2,772
17년 전 조회 1,606
17년 전 조회 2,018
17년 전 조회 1,618
17년 전 조회 2,070
17년 전 조회 2,675
17년 전 조회 8,845
17년 전 조회 3,301
17년 전 조회 4,366
17년 전 조회 2,132
17년 전 조회 3,798
17년 전 조회 1,710
17년 전 조회 1,521
17년 전 조회 2,453
17년 전 조회 1,459
17년 전 조회 1,758
17년 전 조회 1,604
17년 전 조회 2,683
17년 전 조회 1,635
17년 전 조회 1,230
17년 전 조회 1,366
17년 전 조회 3,257
17년 전 조회 2,296
17년 전 조회 2,096
17년 전 조회 1,355
17년 전 조회 2,582
17년 전 조회 1,307
17년 전 조회 1,262
17년 전 조회 1,514
17년 전 조회 2,881
17년 전 조회 2,541
17년 전 조회 2,609
17년 전 조회 1,315
17년 전 조회 1,431
17년 전 조회 3,394
17년 전 조회 2,964
17년 전 조회 4,239
17년 전 조회 2,401
17년 전 조회 2,497
17년 전 조회 1,555
17년 전 조회 2,667
17년 전 조회 2,342
17년 전 조회 3,109
17년 전 조회 2,615
17년 전 조회 1,765
17년 전 조회 2,553
17년 전 조회 1,710
17년 전 조회 1,294
17년 전 조회 2,366
17년 전 조회 3,008
17년 전 조회 4,197
17년 전 조회 3,278
17년 전 조회 1,542
17년 전 조회 1,782
17년 전 조회 2,376
17년 전 조회 1,680
17년 전 조회 1,857
17년 전 조회 2,827
17년 전 조회 2,273
17년 전 조회 1,922
17년 전 조회 4,325
17년 전 조회 3,166
17년 전 조회 1,565
17년 전 조회 3,695
17년 전 조회 2,931
17년 전 조회 2,198
17년 전 조회 1,426
17년 전 조회 2,463
17년 전 조회 2,194
17년 전 조회 2,105
17년 전 조회 2,054
17년 전 조회 1,295
17년 전 조회 2,008
17년 전 조회 3,053
17년 전 조회 1,553
17년 전 조회 1,799
17년 전 조회 1,472
17년 전 조회 1,733
17년 전 조회 1,691
17년 전 조회 1,590
17년 전 조회 2,680
17년 전 조회 2,446
17년 전 조회 2,236
17년 전 조회 1,532