亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery實現(xiàn)鼠標滑過商品小圖片上顯示對應大圖片功能【測試可用】

 更新時間:2018年04月27日 08:49:58   作者:qq_36410795  
這篇文章主要介紹了jQuery實現(xiàn)鼠標滑過商品小圖片上顯示對應大圖片功能,涉及jQuery事件響應、元素遍歷及屬性動態(tài)操作相關實現(xiàn)技巧,需要的朋友可以參考下

本文實例講述了jQuery實現(xiàn)鼠標滑過商品小圖片上顯示對應大圖片功能。分享給大家供大家參考,具體如下:

1 . 效果截圖

2 . 代碼

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>chabaoo.cn jQuery圖片變換</title>
</head>
<style type="text/css">
 .show{width:330px; height:auto; margin:50px auto; background:#eee}
 .item{background:#fff; width:300px; height:auto; float:left; margin:15px;}
 p{ padding:15px; color:#ff6600}
 .big-photo img{ width:300px; height:300px; border:1px solid #e0e0e0}
 .des-small img{ width:30px; height:30px;border:1px solid #e0e0e0; }
 .des-small img:hover{ border:1px solid #ff6600}
 .clear{clear:both}
</style>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
 $(function() {
  /** 更換小圖片 */
  $(".item a").hover(function(){
   changeImg($(this))
  }); 
 });
 function changeImg(obj){
  if(obj.find("img").attr("alt")=="small"){
   var temp_big_src = obj.siblings('a').find('img[alt=big]').attr('src');
   var temp_big_url = obj.siblings('a[class=big-photo]').attr('href');
   var temp_small_src = obj.find('img').attr('src');
   var temp_small_url = obj.attr('href');
   obj.siblings('a').find('img[alt=big]').attr('src',temp_small_src);
  }
 }
</script>
<body>
 <div class="show">
  <p>Jquery實現(xiàn)鼠標移動/移過到商品小圖片上時替換掉大圖片上的圖片</p>
  <div class="item">
   <a class="big-photo">
    <img src="WR_00001.jpg" alt="big"/>
   </a>
   <a class="des-small">
    <img src="WR_00002.jpg" alt="small"/>
   </a>
   <a class="des-small">
    <img src="WR_00003.jpg" alt="small"/>
   </a>
   <a class="des-small">
    <img src="WR_00004.jpg" alt="small"/>
   </a>
  </div>
  <div class="clear"></div>
 </div>
</body>
</html>

附:完整實例代碼點擊此處本站下載

更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結》、《jQuery動畫與特效用法總結》、《jQuery擴展技巧總結》、《jQuery常用插件及用法總結》、《jQuery常見經典特效匯總》及《jquery選擇器用法總結

希望本文所述對大家jQuery程序設計有所幫助。

相關文章

最新評論