<html>
<head>
</head>
<script language="javascript" >
/*
rotate the div(a1)
*/
var div_a1;
function init(){
div_a1 = document.getElementById('a1');
aa = setInterval("rotate_div()", 50); // 1000 = 1초 1초마다 roofing_func 를 실행하라.~
}
var aa = 0;
function rotate_div(){
//div_a1.style.left = e.offsetX - 20 + 'px';
//div_a1.style.top = e.offsetY - 20 + 'px';
aa += 1;
if( aa > 360 )
aa = 0;
div_a1.style.webkitTransform = 'rotate(' + aa + 'deg)';
}
</script>
<body onload="init();" >
<div id="groundDiv" style="position:relative; width:99%; height:99%; border:0x solid black;"></div>
<div id='a1' style="position:absolute; width:3px; height:50px; border:2px solid black;top:100px;left:100px " ></div>
</body>
</html>
'[.js] div 의 이동' 카테고리의 다른 글
클릭 드레그 하면 따라다니는 div (0) | 2017.09.07 |
---|---|
한 점을 기준으로 + 를 회전시킴 (0) | 2017.09.06 |
click 누르면 div를 생성해서 특정 위치에 위치시킨다. (0) | 2017.09.06 |