이 기사에서는 이미지를 통해 JS 마우스 스 와이프의 특수 효과를 진동하는 방법에 대해 설명합니다. 참조를 위해 공유하십시오. 특정 구현 방법은 다음과 같습니다.
다음과 같이 코드를 복사하십시오. <html>
<헤드>
<meta http-equiv = "content-type"content = "text/html; charset = gb2312">
<title> 그림 진동 효과 위로 마우스를 스 와이프하십시오. </title>
<스타일> .ShakeImage {
위치 : 상대
}
</스타일>
</head>
<body>
<스크립트 언어 = javaScript1.2>
<!-
var 반사기 = 3
var stop = 0
var a = 1
함수 init (who) {
stopit = 0
Shake = 어느 것
shake.style.left = 0
shake.style.top = 0
}
함수 RattleImage () {
if ((! document.all &&! document.getElementById) || stopit == 1)
반품
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)-소터
}
또 다른{
shake.style.left = parseint (Shake.style.left)-소터
}
if (a <4)
A ++
또 다른
a = 1
settimeout ( "rattleimage ()", 50)
}
함수 stoprattle (who) {
stopit = 1
what.style.left = 0
what.style.top = 0
}
//->
</스크립트>
<img onmouseover = "init (this); rattleImage ()"onMouseOut = "stopRattle (this)"Src = "/images/csrcode.ico"style = "커서 : 포인터;"/>
<img onmouseover = "init (this); rattleImage ()"onmouseout = "stoprattle (this)"src = "/images/changshi.ico"style = "커서 : 포인터;"/>
<img onMouseOver = "init (this); rattleImage ()"onMouseOut = "stopRattle (this)"src = "/images/links.ico"style = "커서 : 포인터;"/>
마우스를 이미지 미리보기 효과 위로 밀어 넣습니다.
</body>
</html>
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.