百度分頁特效

來源:互聯網
上載者:User

百度這幾天突然間在分頁按鈕上做了點手腳,其實沒什麼技術含量,個人感覺創新也不錯,倒是給我的感覺還有點像足跡的味道。反正晚上閑來無事於是也做了一個類似於百度的分頁效果

:基於jquery的一個效果。www.dayday28.com

 

原理就是所有為奇數的足跡元素給不一樣的樣式而已,其它的非奇數元素就按預設的樣式。

下面就直接貼源碼了:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">      <html xmlns="http://www.w3.org/1999/xhtml">      <head>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />      <title>無標題文檔</title>      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>      <style type="text/css">      .page{padding:100px 0;zoom:1}      .page:after{content:"";display:block;height:0;clear:both;visibility:hidden;}      .page span{position:relative;margin:0 2px;border:solid 1px #ccc;float:left;}      .page span a{padding:2px 5px;cursor:pointer;}      .page span i{display:block;height:10px;width:10px;background:#ccc;border-radius:50%;position:absolute;left:50%;top:-20px;margin-left:-5px;}      .page span i.active_i{background:red;}      </style>      <script type="text/javascript">      $(document).ready(function(){              function  pageStyle(obj,even,bg,active_bg){                  /*參數說明:                  obj為所有奇數元素                  even當前所要點擊觸發事件                  bg為足跡元素                  active_bg為點擊後的足跡背景                  2012-9-2                  作者:zoowar                  Email:zoowar@qq.com                  部落格:www.dayday28.com                  */                  $(obj).css("top","-30px");                  $(even).click(function(){                      $(this).siblings(bg).addClass(active_bg).parent().siblings().find(bg).removeClass(active_bg);                  })              }              pageStyle(".page i:even",".page a","i","active_i");          })      </script>      </head>                             <body>      <div class="page">          <span><a>上一頁</a></span>          <span><a>1</a><i class="active_i"></i></span>          <span><a>2</a><i></i></span>          <span><a>3</a><i></i></span>          <span><a>4</a><i></i></span>          <span><a>5</a><i></i></span>          <span><a>5</a><i></i></span>          <span><a>6</a><i></i></span>          <span><a>7</a><i></i></span>          <span><a>8</a><i></i></span>          <span><a>9</a><i></i></span>          <span><a>下一頁</a></span>      </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.