基於jquery的熱點內容輪換效果

來源:互聯網
上載者:User

:

核心代碼:
複製代碼 代碼如下:
<div class="blockB" collection="Y" >
<h2><span>王牌欄目 Regular features</span></h2>
<div id="regular_features" class="pp">
<div class="tabs"> <a class="on" href="http://meinv.vs2010.com/topic/9/201107/show-id2265.html" target="_blank">世界最美</a><a href="http://meinv.vs2010.com/topic/8/201107/show-id2295.html" target="_blank">哇!好玩</a><a href="http://meinv.vs2010.com/topic/6/201107/show-id2254.html" target="_blank">窮遊世界</a><a href="http://meinv.vs2010.com/topic/6/201106/show-id2211.html" target="_blank">周末駕到</a> </div>
<ul>
<li><a href="http://meinv.vs2010.com/topic/9/201107/show-id2265.html"target="_blank"><img src="http://www.bkjia.com/uploads/allimg/131016/1PA94313-1.jpg" alt="少女傲人雙峰自拍" border="0"></a> <span><a href="http://meinv.vs2010.com/topic/9/201107/show-id2265.html" target="_blank">少女傲人雙峰自拍</a></span> </li>
<li><a href="http://meinv.vs2010.com/topic/8/201107/show-id2295.html" target="_blank"><img alt="日本酥胸美女杉原杏" src="http://www.bkjia.com/uploads/allimg/131016/1PAa612-2.jpg"></a> <span><a href="http://meinv.vs2010.com/topic/8/201107/show-id2295.html" target="_blank">日本酥胸美女杉原杏</a></span> </li>
<li><a href="http://meinv.vs2010.com/topic/6/201107/show-id2254.html" target="_blank"><img src="http://www.bkjia.com/uploads/allimg/131016/1PA964O-3.jpg" alt="性感美女黑色內衣" border="0"></a> <span><a href="http://meinv.vs2010.com/topic/6/201107/show-id2254.html" target="_blank">性感美女黑色內衣</a></span> </li>
<li><a href="http://meinv.vs2010.com/topic/6/201106/show-id2211.html" target="_blank"><img src="http://www.bkjia.com/uploads/allimg/131016/1PAa5a-4.jpg" alt="絕美性感黑絲美眉" border="0"></a> <span><a href="http://meinv.vs2010.com/topic/6/201106/show-id2211.html" target="_blank">絕美性感黑絲美眉</a></span> </li>
</ul>
</div>
<script type="text/javascript">
jQuery(function (j) {
var r = j('#regular_features'),
btns = r.find('> div.tabs > a'),
el_ani = r.find('> ul'),
el_pages = el_ani.find('> li'),
pages = el_pages.length,
p = 0,
pw = 219;
btns.each(function (idx, btn) {
btn = j(btn);
btn.mouseenter(function (ev) {
if (idx != p) {
j(btns[p]).removeClass('on');
btn.addClass('on');
p = idx;
el_ani.stop().animate({ top: -pw * idx }, 300);
}
return false;
});
}).eq(1).mouseenter();
});
</script>
</div>

示範代碼:
<!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><title> </title> <style> /* 全域CSS定義 */ div,form,ul,ol,li,span,p,dl,dt,dd,img{margin:0;padding:0;border:0;} h1,h2,h3,h4,h5,h6{margin:0;padding:0;font-size:12px;font-weight:normal;} ul,ol,li{list-style:none} table,td,input,textarea{font-size:12px} .blockB{margin-bottom:22px;margin-right:11px;padding-bottom:22px;border-bottom:1px solid #e8eee0; background:url(/upload/201107/20110709230423180.gif) no-repeat 0 99px;} .blockB .pp{ margin-left:51px; height:223px; position:relative; top:0; overflow:hidden; width:248px; } .blockB .tabs{float:left;width:68px;font-size:14px;font-weight:700;line-height:16px;} .blockB .tabs a{width:38px;padding:5px 24px 0 6px;height:36px;display:block;color:#fff; margin-bottom:12px;background:#639805 url(/upload/201107/20110709230423555.gif) no-repeat 0 -45px; text-decoration:none;} .blockB .tabs a.on{background-position:0 0;background-color:#ff8c10;cursor:default;} .blockB ul{ width:130px; float:left; position:relative; top:0; } .blockB li{ padding:4px; background:#639805; height:211px; overflow:hidden; width:120px; } .blockB li a{color:#fff;} .blockB li span {display:block;padding-top:5px;height:15px;font-size:12px;text-align:center} h2 { height: 35px; line-height: 33px; margin-bottom: 5px; text-align: right; } h2 span {display: none;float: left;font-weight: bold;} .pp img {display: block;margin: 0 auto;} </style> </head> <body> 王牌欄目 Regular features 世界最美哇!好玩窮遊世界周末駕到 <ul> <li> 少女傲人雙峰自拍 </li> <li> 日本酥胸美女杉原杏 </li> <li> 性感美女黑色內衣 </li> <li> 絕美性感黑絲美眉 </li> </ul> </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]

相關文章

聯繫我們

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