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

首頁 > 編程 > JavaScript > 正文

jquery實現圖片列表鼠標移入微動

2019-11-19 18:43:44
字體:
來源:轉載
供稿:網友

本效果使用jQuery和CSS實現了圖片列表,當鼠標移入時圖片向左微動,移出則復原。

其中的jQuery事件使用mouseenter 和 mouseleave ,事件綁定方法使用新推薦的on方法。

代碼如下:

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1" /> <title>jQuery實現圖片列表鼠標移入微動_何問起</title><base target="_blank" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> body, div, li, p, img, a {  margin: 0;  padding: 0; } .hovertreecontainer {  width: 370px;  margin: 50px auto; }  .hovertreecontainer a {  text-decoration: none;  } .hovertree-item-box {  height: 120px;  width: 185px;  position: relative;  padding: 10px;  box-sizing: border-box;  float: left; }  .hovertree-item-box .title {  width: 80px;  height: 100%;  color: #4998a1;  font-size: 14px;  }  .hovertree-item-box.odd {  border-bottom: 1px solid #CCC;  border-right: 1px solid #CCC;  }  .hovertree-item-box.even {  border-bottom: 1px solid #CCC;  }  .hovertree-item-box.nobottom {  border-bottom: none;  }  .hovertree-item-box .hovertree-img-box {  width: 80px;  height: 80px;  overflow: hidden;  position: absolute;  right: 10px;  bottom: 5px;  } .hovertree-img-box img {  width: 100%;  height: 100%; } .hovertreecontainer:after {  content: "";  display: block;  clear: both; } </style></head><body> <div class="hovertreecontainer"><h2>jQuery實現圖片列表鼠標移入微動</h2> <a >  <div class="hovertree-item-box odd">  <div class="title">春節對聯</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/201512/o9qashmi.gif"></div>  </div> </a> <a >  <div class="hovertree-item-box even">  <div class="title">下雨天</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/201512/f748s0ko.jpg"></div>  </div> </a> <a >  <div class="hovertree-item-box odd">  <div class="title">磨砂玻璃</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/201512/agagq0or.jpg"></div>  </div> </a> <a >  <div class="hovertree-item-box even">  <div class="title">網頁特效</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/201512/r51a22uy.gif"></div>  </div> </a> <a >  <div class="hovertree-item-box odd nobottom">  <div class="title">何問起統計文件數</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/bjafjd/iofopnro.png"></div>  </div> </a> <a >  <div class="hovertree-item-box even nobottom">  <div class="title">HovertreeImg</div>  <div class="hovertree-img-box"><img src="http://hovertree.com/hvtimg/201601/p3t2ldyr.png"></div>  </div> </a> <div><a >原文</a> <a >首頁</a> <a >特效</a></div> </div> <script type="text/javascript" src="http://down.hovertree.com/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(function () {  $('.hovertreecontainer .hover'+'tree-item-box').on('mouseenter', function (ev) {  var oImgBox = $(this).find('.hovertree-img-box');  $(oImgBox).stop(true).animate({   right: '20px'  }, "normal");  }).on('mouseleave', function (ev) {  var oImgBox = $(this).find('.hovertree-img-box');  $(oImgBox).stop(true).animate({   right: '10px'  }, "normal");  }); }); </script></body></html>

以上就是本文的全部內容,希望對大家有所幫助,同時也希望多多支持武林網!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐至县| 缙云县| 景德镇市| 南城县| 齐齐哈尔市| 光山县| 枞阳县| 云阳县| 陆良县| 独山县| 澳门| 兴业县| 泰兴市| 通州市| 花莲市| 沈阳市| 岳阳市| 桦川县| 托里县| 南澳县| 河北省| 新闻| 延安市| 南投市| 长垣县| 子长县| 思茅市| 察雅县| 宜宾市| 鹤山市| 临湘市| 丹巴县| 临高县| 黄梅县| 阳东县| 休宁县| 乐陵市| 横山县| 通化市| 霞浦县| 双辽市|