溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

使用jQuery實(shí)現(xiàn)推拉門效果代碼示例

發(fā)布時(shí)間:2020-10-27 19:10:24 來源:億速云 閱讀:188 作者:Leah 欄目:開發(fā)技術(shù)

今天就跟大家聊聊有關(guān)使用jQuery實(shí)現(xiàn)推拉門效果代碼示例,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

方法:anemate(), stop(), siblings()

動(dòng)畫效果:

使用jQuery實(shí)現(xiàn)推拉門效果代碼示例

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>推拉門</title>
 <script src="../jquery.min.js"></script>
 
 <style>
  *{
   margin: 0;
   padding: 0;
   list-style: none;
  }
  .container{
   margin: 50px auto;
   width: 988px;
   height: 405px;
   overflow: hidden;
  }
  img{
   width: 538px;
   height: 405px;
  }
  .container ul li{
   float: left;
   width: 75px;
   height: 405px;
  }
 
  .container ul li.active{
   width: 538px;
  }
 </style>
</head>
<body>
<div class="container">
 <ul>
  <li class="active"><img src="images/1.jpg" alt="圖片1"></li>
  <li><img src="images/2.jpg" alt="圖片1"></li>
  <li><img src="images/3.jpg" alt="圖片1"></li>
  <li><img src="images/4.jpg" alt="圖片1"></li>
  <li><img src="images/5.jpg" alt="圖片1"></li>
  <li><img src="images/6.jpg" alt="圖片1"></li>
  <li><img src="images/7.jpg" alt="圖片1"></li>
 </ul>
</div>
<script type="text/javascript">
 $(document).ready(function () {
  $(".container ul li").mouseover(function () {
   // $(this).addClass("active");
   // $(this).siblings().removeClass("active");
   $(this).stop(true,false ).animate({width:538},500);
   $(this).siblings().stop(true,false).animate({width:75},500);
  });
 });
</script>
</body>
</html>

看完上述內(nèi)容,你們對使用jQuery實(shí)現(xiàn)推拉門效果代碼示例有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI