JS+CSS實現滑鼠經過彈出一個DIV框完整執行個體(帶緩衝動畫漸層效果),cssdiv

來源:互聯網
上載者:User

JS+CSS實現滑鼠經過彈出一個DIV框完整執行個體(帶緩衝動畫漸層效果),cssdiv

本文執行個體講述了JS+CSS實現滑鼠經過彈出一個DIV框效果。分享給大家供大家參考,具體如下:

<!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>js+CSS實現表格漸層</title><style>#tip{position:absolute;left:90px;width:0px;height:0px;color:#FFF;font-size:12px;background-color:#000;border:1px solid #DEF;filter:Alpha(Opacity=0);opacity:0;z-index:999;}</style><script type="text/javascript"><!--//定義“獲得指定dom節點”的函數,因為其重用率高function $(d){return document.getElementById(d);}//控制div逐漸顯示var i = 0;function change_show(){var obj = $("tip");i=i+5; //逐漸顯示速度obj.style.filter = "Alpha(Opacity=" + i + ")"; //透明度逐漸層小obj.style.opacity = i/100; //相容FireFoxif(i>=100){clearInterval(s);i=0;}}//控制div逐漸消失var j = 100;function change_hidden(){var obj = $("tip");j=j-5; //逐漸消失速度obj.style.filter = "Alpha(Opacity=" + j + ")"; //透明度逐漸層大obj.style.opacity = j/100; //相容FireFoxif(j<=0){clearInterval(h);//obj.style.display="none";j=100;}}//控制change_show()行為var s;function show(){if(s){clearInterval(s);}$("tip").style.display="block";s = setInterval(change_show,1);}//控制change_hidden()行為var h;function hiddentip(){$("tip").innerHTML="";h = setInterval(change_hidden,1);}//--></script></head><body>滑鼠滑過這裡,漸層出現<div id="tip" style="background-color:blue;width:48%;height:48%;" onmouseover="show();" onmouseout="hiddentip();"></div></body></html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.