欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)自動(dòng)切換播放的經(jīng)典滑動(dòng)門(mén)效果

 更新時(shí)間:2015年09月12日 12:24:52   作者:企鵝  
這篇文章主要介紹了jQuery實(shí)現(xiàn)自動(dòng)切換播放的經(jīng)典滑動(dòng)門(mén)效果,可實(shí)現(xiàn)tab自動(dòng)定時(shí)切換的功能,涉及jQuery基于定時(shí)函數(shù)動(dòng)態(tài)操作頁(yè)面元素的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)自動(dòng)切換播放的經(jīng)典滑動(dòng)門(mén)效果。分享給大家供大家參考。具體如下:

這是一個(gè)滑動(dòng)門(mén)代碼,從外觀上看,簡(jiǎn)潔經(jīng)典,似乎與平時(shí)見(jiàn)到的滑動(dòng)門(mén)沒(méi)什么區(qū)別,不過(guò)它有一個(gè)重要的功能與眾不同,那就是會(huì)自動(dòng)切換【播放】滑動(dòng)門(mén)的內(nèi)容,像騰訊QQ登錄后彈出的每日要聞一樣,如果你再加以美化,那么就更完美無(wú)暇了。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.jb51.net/js/2015/jquery-auto-cha-tab-style-codes/

具體代碼如下:

<!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" />
<script type="text/javascript" src="jquery1.3.2.js"></script>
<title>autoTab,自動(dòng)切換播放的滑動(dòng)門(mén)</title>
</head>
<style>
*{ margin:0; padding:0;}
ul{ list-style:none}
body{ font-size:12px}
#tabMenus{ width:400px; margin:100px auto 0 auto;overflow:hidden; border:#ccc solid 1px; border-bottom:none;}
#tabMenus li{ float:left; width:100px; height:25px; line-height:25px; background:#ccc; text-align:center}
#tabMenus li a{ display:block; height:100%; color:#000000; text-decoration:none}
#tabMenus li.current{background:#fff}
#tabMenus li.usual{background:#ccc;}
#tabCons{ clear:both;width:400px; margin:0 auto; overflow:hidden; border:#ccc solid 1px; border-top:none}
#tabCons .con{ float:left; padding:10px; width:380px; display:none}
</style>
<script>
$(document).ready(function(){
 var j=0;
 $("#tabMenus li:first").addClass("current");
 $("#tabCons div:first").show();
 $("#tabMenus li").each(function(i){
 $(this).click(function(){
    $(this).addClass("current").siblings().removeClass();
    $("#tabCons > div").hide();
    $("#tabCons div:eq(" + i + ")").show();
  })
 })
 var t=setInterval(function(){
   $("#tabMenus li:eq("+j+")").trigger("click");
   if(j<3){
    j++;
   }else{
    j=0;
   }
 },1000)
})
</script>
<body>
<ul id="tabMenus">
<li><a href="#">1111</a></li>
<li><a href="#">2222</a></li>
<li><a href="#">3333</a></li>
<li><a href="#">4444</a></li>
</ul>
<div id="tabCons">
<div class="con">1111</div>
<div class="con">2222</div>
<div class="con">3333</div>
<div class="con">4444</div>
</div>
</body>
</html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論