国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 擴展 > jQuery > 正文

基于Jquery的淡入淡出的特效基礎練習

2024-09-06 20:04:39
字體:
來源:轉載
供稿:網友

基于Jquery的淡入淡出的特效基礎練習實現代碼,學習jquery的朋友可以參考下。
今天練習了個Jquery淡入淡出的特性代碼如下:

 

<!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='text/javascript' src='jquery-1.2.6.min.js'></script> <style type="text/css"> #gallery1 {width:100%; overflow:hidden;} #gallery1 a {position:relative; float:left; margin:5px;} #gallery1 a span { display:none; background-image:url(zoom.png); background-repeat:no-repeat; width:48px; height:48px; position:absolute; left:15px; top:15px;} #gallery1 img { border: solid 1px #999; padding:5px;} #gallery1 a:hover span { display:block;} #gallery2 {width:100%; overflow:hidden;} #gallery2 a {position:relative; float:left; margin:5px;} #gallery2 a span { display:none; background-image:url(zoom.png); background-repeat:no-repeat; width:48px; height:48px; position:absolute; left:15px; top:15px;} #gallery2 img { border: solid 1px #999; padding:5px;} </style> <script> $(document).ready(function(){ $("#gallery2 a").append("<span></span>"); $("#gallery2 a").hover(function(){ $(this).children("span").fadeIn(600); },function(){ $(this).children("span").fadeOut(200); }); }); </script> </head> <body> <div id="gallery1"> <h2>CSS solution</h2> <a href="1.jpg"> <span></span> <img src="1.jpg" alt="" /> </a> <a href="2.jpg"> <span></span> <img src="2.jpg" alt="" /> </a> </div> <div id="gallery2"> <h2>jQuery solution</h2> <a href="1.jpg"> <img src="1.jpg" alt="" /> </a> <a href="2.jpg"> <img src="2.jpg" alt="" /> </a> </div> </body> </html> 

用到的圖片:
一個淡入淡出小例子:

 

<body> <form action="" method="post" id ="myform"> <button value="Click Me">Click Me</button> <p style="background:red;" >context<br>context<br>context<br>context</p> </form> </body> </html> //Jquery代碼 //復制代碼 代碼如下:$(document).ready( function() { /*淡入淡出*/ $("button").toggle( function (){ $("p").fadeOut("fast",function(){ } ) }, function (){ $("p").fadeIn("fast",function(){ } ) } ); }); 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广南县| 海淀区| 石门县| 南雄市| 安西县| 鲁甸县| 南召县| 富川| 莒南县| 大埔区| 景谷| 辽中县| 池州市| 道真| 南开区| 元江| 马鞍山市| 阜平县| 敖汉旗| 余干县| 息烽县| 长垣县| 纳雍县| 吴堡县| 佛学| 上犹县| 水富县| 安龙县| 博白县| 钦州市| 宁都县| 凤凰县| 苏尼特右旗| 班玛县| 西乌珠穆沁旗| 克什克腾旗| 阳西县| 北安市| 新余市| 万载县| 讷河市|