jQuery滑動導覽功能表

來源:互聯網
上載者:User

標籤:jquery   導航   滑動導航   動畫   

<!DOCTYPE HTML>   <html>   <head>   <meta charset="UTF-8" />   <meta name="author" content="abangsir" />   <title>jQuery彈性滑動導覽功能表</title>   <style type="text/css">   body{ font-family:"Microsoft YaHei";}   .lavalamp{ width:700px; float:right; position: relative;}  .lavalamp ul{ height: 35px; width: 100%; margin:17px 20px 0 0; position: absolute; z-index: 9999; overflow: hidden;}  .lavalamp ul li{ cursor: pointer; height: 35px; line-height:35px; font-size:20px; background: none; font-weight:bold; float:left; text-align: center;}  .lavalamp ul li a{ text-decoration: none; padding: 0 13px; text-align: center; display: block; background: none;}  .floatr {      position: absolute;      top: 15px;      width: 107px;      height: 40px;      border-radius : 8px;      -moz-border-radius : 8px;      -webkit-border-radius : 8px;      background : rgba(0,0,0,.20);      -webkit-transition: all .4s ease-in-out;      -moz-transition: all .4s ease-in-out;    }  </style> <script type="text/javascript" src="jquery-1.8.3.min.js"></script> <script type="text/javascript">$(document).ready(function () {        var active_width = $(".active").innerWidth();      var active_left = $(".active").position().left;      $(".floatr").css(          {              width:active_width,              left:active_left          }      );        $(".lavalamp ul>li").hover(          function(){              var width = $(this).innerWidth();              var left = $(this).position().left;                $(".floatr").stop().animate(                  {                      width: width,                      left: left                  },                  300              );            },          function(){                $(".floatr").stop().animate(                  {                      width: active_width,                      left: active_left                  }              );            }      );    });  </script> </head> <body><div class="lavalamp">       <ul>            <li class="active"><a href="#">新品上市</a></li>            <li><a href="#">暢銷精品</a></li>            <li><a href="#">推薦禮品</a></li>            <li><a href="#">知名品牌</a></li>            <li><a href="#">工藝禮品</a></li>            <li><a href="#">回到首頁</a></li>       </ul>       <div class="floatr"></div>  </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.