基於jQuery實現仿百度首頁選項卡轉場效果_jquery

來源:互聯網
上載者:User

以下代碼比較簡單,所以沒給大家附太多的注釋,有問題歡迎給我留言,具體詳情請看下文代碼吧。

先給大家展示下效果圖:

代碼如下:

<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jQuery仿百度首頁選項卡轉場效果 - 何問起</title><base target="_blank" /><style type="text/css">body {background: url(http://hovertree.com/texiao/jquery/71/images/65.jpg) no-repeat fixed center center;}.hovertreepage .clear {clear: both;}.hovertreepage {margin: 200px auto 0 auto;width: 700px;height: 300px;}.hovertreepage .left, .hovertreepage .right {float: left;}.hovertreepage .nav-back {width: 60px;height: 300px;background: #000;opacity: .3;filter: alpha(opacity=30);}.hovertreepage .nav {position: relative;margin-top: -300px;width: 60px;text-align: center;font-size: 14px;font-family: "微軟雅黑";color: #fff;}.hovertreepage .nav div {height: 32px;line-height: 28px;cursor:pointer;}.hovertreepage .nav div.on {background: #0094ea;}.hovertreepage .right {width: 620px;height: 300px;margin-left: 20px;}.hovertreepage .content-back {width: 620px;height: 300px;background: #fff;opacity: .3;}.hovertreepage .content {position: relative;width: 600px;height: 280px;margin-top: -300px;padding: 10px;overflow: hidden;}.hovertreepage .content a{color:blue;}.hovertreepage .content div {width: 600px;height: 280px;margin-bottom: 10px;background: #fff;}</style></head><body><div class="hovertreepage"><div class="left"><div class="nav-back"></div><div class="nav"><div class="on">導航</div><div>新聞</div><div>世界盃</div><div>音樂</div><div>彩票</div></div></div><div class="right"><div class="content-back"></div><div class="content"><div>1 <a href="http://hovertree.com">首頁</a> <a href="http://hovertree.com/texiao/">特效</a> <a href="http://hovertree.com/h/bjaf/n781jmfy.htm">原文</a></div><div>2 </div><div>3 <a href="http://hovertree.com/texiao/jquery/70/color.htm">服裝店風雲</a> 自從接觸編程以後,興趣就一直有增無減。</div><div>4 <a href="http://hovertree.com/h/bjaf/ati6k7yk.htm">jQuery全部版本下載</a>時間就是金錢,效率就是生命。</div><div>5 <a href="http://hovertree.com/texiao/html5/30/"><img src="http://hovertree.com/hvtimg/bjafjd/wmt3mxd7.png" alt="孫悟空" /></a></div></div></div><div class="clear"></div></div><script type="text/javascript" src="http://down.hovertree.com/jquery/jquery-1.12.3.min.js"></script><script type="text/javascript">$(".hovertreepage .nav div").mouseenter(function () {var $this = $(this);var index = $this.index();}).mouseleave(function () {var $this = $(this);var index = $this.index();}).click(function () {var $this = $(this);var index = $this.index();var l = -(index * 290);$(".hove"+"rtreepage .nav div").removeClass("on");$(".hovertreepage .nav div").eq(index).addClass("on");$(".hovertreepage .content div:eq(0)").stop().animate({ "margin-top": l }, 500);});</script></body></html>

以上內容是小編給大家介紹的基於jQuery實現仿百度首頁選項卡轉場效果,希望對大家有所協助!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.