원

마우스를 이미지 위에 올렸을때 이미지 흔들기

· 2010-06-30 (수) 11:22:56 · 3132

 

<style>
.shakeimage
{
position:relative
}
</style>

<script>
var rector=3
var stopit=0
var a=1

function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}

function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}
</script>

그 다음 스크립트는 넣었으면 <body></body>안에 있는 이미지중 스크립트를 적용시킬 이미지를 찾아서 이미지 태그안에 이렇게 추가합니다. <class="shakeimage" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this)">

[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-07-13 조회 2,172
16-07-12 조회 2,360
16-07-12 조회 2,386
16-07-11 조회 2,194
16-06-05 조회 2,923
16-06-03 조회 3,045
16-05-26 조회 2,965
15-09-22 조회 4,992
15-06-10 조회 4,838
14-10-25 조회 6,368
14-10-22 조회 8,989
14-09-21 조회 5,794
14-09-16 조회 5,081
14-08-22 조회 1.1만
14-08-13 조회 5,917
14-08-12 조회 5,446
14-08-12 조회 6,308
14-08-11 조회 6,935
14-06-12 조회 6,219
14-06-11 조회 5,119
14-05-09 조회 5,435
14-05-09 조회 6,394
14-05-09 조회 6,423
14-05-08 조회 5,757
14-04-17 조회 4,767
14-04-16 조회 4,592
14-04-15 조회 4,593
14-04-15 조회 4,541
14-04-15 조회 4,312
14-04-14 조회 4,293
14-04-14 조회 4,267
14-04-14 조회 4,643
14-04-14 조회 4,783
14-04-14 조회 4,772
14-04-13 조회 4,674
14-04-12 조회 4,244
14-04-12 조회 4,385
14-04-12 조회 4,493
14-04-11 조회 5,015
14-04-10 조회 4,753
14-04-10 조회 4,784
14-04-09 조회 4,945
14-04-09 조회 5,315
14-04-08 조회 6,981
13-10-30 조회 7,663
13-07-11 조회 5,143
13-03-28 조회 1.1만
13-02-27 조회 6,795
13-02-14 조회 5,618
13-01-10 조회 4,524
12-12-31 조회 5,107
12-12-20 조회 6,124
12-12-12 조회 5,281
12-12-07 조회 4,512
12-11-28 조회 4,863
12-11-22 조회 5,306
12-11-12 조회 5,663
12-09-22 조회 4,520
12-09-18 조회 4,707