搜尋
首頁php教程PHP开发jsp圖片效果大全(影像震動效果、閃爍效果、自動切換影像)

本文主要介紹jsp實現圖像震動效果、閃爍效果、自動切換圖像的資料,廢話不多說了,具體代碼如下:

1.當鼠標指針經過圖像時圖像震動效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>当鼠标指针经过图像时图像震动效果</title>
<style type="text/css">
.zhendimage{ position:relative; }
</style>
<script type="application/javascript" >
var rector =3;
var stopit = 0;
var a=1;
var zhend;
function init(which)
{
  stopit =0;
  zhend = which;
  zhend.style.left =0;
  zhend.style.top =0;
}
function rattleimage()
{
  if(stopit==1)
  {
    return;
  }  
  if(a==1)
  {
    zhend.style.top = parseInt(zhend.style.top)+rector+"px";
  }
  else if(a==2)
  {
    zhend.style.left = parseInt(zhend.style.left)+rector+"px";
  }
  else if(a==3)
  {
    zhend.style.top = parseInt(zhend.style.top)-rector+"px";
  }
  else
  {
    zhend.style.left = parseInt(zhend.style.left)-rector+"px";
  }
  if(a<4)a++;  else a =1;
  setTimeout("rattleimage()",50);
}
 
function stoprattle(which)
{
  stopit = 1;
  which.style.left =0;  
  which.style.top =0;    
}
</script>
</head>
 
<body>
<div>
<img class="zhendimage lazy"  src="/static/imghwm/default1.png"  data-src="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg002.png"   onmousemove="init(this);rattleimage();"
onmouseout="stoprattle(this);"  /></div>
</body>
</html>

2.圖片閃爍效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片闪烁效果</title>
<script type="application/javascript">
 
function blink()
{
//定义图片的显示和隐藏属性
tp.style.visibility = (tp.style.visibility=="hidden")?"visible":"hidden";  
//每0.5秒刷新一次
setTimeout("blink()",500);
}
</script>
</head>
 
<body onload="blink();">
<div id="tp">
<img  src="/static/imghwm/default1.png"  data-src="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg"  class="lazy"     style="max-width:90%" / alt="jsp圖片效果大全(影像震動效果、閃爍效果、自動切換影像)" >
</div>
</body>
</html>

3.自動切換影像

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自动切换图像</title>
 
<script type="application/javascript">
var imgs = new Array
(
"http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg",
"http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg004.gif",
"http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_%e6%9a%82%e6%97%a0%e5%9b%be%e7%89%87.gif" 
)
var nums =0;
setInterval("fort()",1000);
function fort()
{
  iimg.src = imgs[nums];  
  nums++;
  if(nums==3)nums=0;
}
</script>
</head>
 
<body>
<div><img  src="/static/imghwm/default1.png"  data-src="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg"  class="lazy"  id="iimg"     style="max-width:90%"  style="max-width:90%" / alt="jsp圖片效果大全(影像震動效果、閃爍效果、自動切換影像)" ></div>
</body>
</html>

希望本文所述對你有所幫助,jsp圖片效果大全(影像震動效果、閃爍效果、自動切換影像)內容就給大家介紹到這裡了。希望大家繼續關注我們的網站!想要學習介紹jsp可以繼續關注本站。

更多jsp圖片效果大全(影像震動效果、閃爍效果、自動切換影像)相關文章請關注PHP中文網!


陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強大的PHP整合開發環境

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),