js鼠標(biāo)滑過圖片震動特效的方法
本文實(shí)例講述了js鼠標(biāo)滑過圖片震動特效的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>鼠標(biāo)滑過 圖片震動效果</title>
<STYLE>.shakeimage {
POSITION: relative
}
</STYLE>
</head>
<body>
<SCRIPT language=JavaScript1.2>
<!--
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>
<img class="shakeimage" onMouseOver="init(this);rattleimage()" onMouseOut="stoprattle(this)" src="/images/csrcode.ico" border="0" style="cursor:pointer;"/>
<img class="shakeimage" onmouseover="init(this);rattleimage()" onmouseout="stoprattle(this)" src="/images/changshi.ico" border="0" style="cursor:pointer;"/>
<img class="shakeimage" onmouseover="init(this);rattleimage()" onmouseout="stoprattle(this)" src="/images/links.ico" border="0" style="cursor:pointer;"/>
鼠標(biāo)滑過圖片預(yù)覽效果。
</body>
</html>
希望本文所述對大家的javascript程序設(shè)計(jì)有所幫助。
相關(guān)文章
javascript實(shí)現(xiàn)點(diǎn)擊按鈕讓DIV層彈性移動的方法
這篇文章主要介紹了javascript實(shí)現(xiàn)點(diǎn)擊按鈕讓DIV層彈性移動的方法,實(shí)例分析了javascript操作div層的操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-02-02深入學(xué)習(xí) JavaScript中的函數(shù)調(diào)用
可能很多人在學(xué)習(xí) JavaScript 過程中碰到過函數(shù)參數(shù)傳遞方式的迷惑,本著深入的精神,我給大家分享了一篇教程關(guān)于javascript中的函數(shù)調(diào)用知識,感興趣的朋友一起學(xué)習(xí)吧2017-03-03jQuery Mobile動態(tài)刷新頁面樣式的實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄猨Query Mobile動態(tài)刷新頁面樣式的實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05javascript靜態(tài)頁面?zhèn)髦档娜N方法分享
這篇文章介紹了javascript靜態(tài)頁面?zhèn)髦档娜N方法及優(yōu)缺點(diǎn),有需要的朋友可以參考一下2013-11-11靜態(tài)頁面實(shí)現(xiàn) include 引入公用代碼的示例
下面小編就為大家?guī)硪黄o態(tài)頁面實(shí)現(xiàn) include 引入公用代碼的示例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09簡單純js實(shí)現(xiàn)點(diǎn)擊切換TAB標(biāo)簽實(shí)例
選項(xiàng)卡效果代碼,無jq,JS來實(shí)現(xiàn),灰色風(fēng)格,沒有怎么美化,或許看上去比較普通,不過兼容性和操作起來挺舒服的,風(fēng)格適用于大部分的網(wǎng)站,或許你會用得上。2015-08-08