下面实例讲述了jQuery简单tab切换效果实现方法。
<script src="js/jquery-latest.js"></script>
<SCRIPT language=javascript type=text/javascript>
('.tabtitle li').click(function () {
var index = (this).attr('class',"tabhover").siblings('li').attr('class','taba');
('.tabtitle li').length ) t = 0;
$('.tabtitle li:eq('+t+')').click();
t++;
}, 700)
})
</SCRIPT>
<div class="maintab">
<ul class="tabtitle">
<li class="tabhover"><a href="#">选择标题1</a></li>
<li class="taba"><a href="#">选择标题2</a></li>
<li class="taba"><a href="#">选择标题3</a></li>
<li class="taba"><a href="#">选择标题4</a></li>
<li class="taba"><a href="#">选择标题5</a></li>
</ul>
<div class="tabcontent">
选择内容1
</div>
<div class="tabcontent" style="DISPLAY: none">
选择内容2
</div>
<div class="tabcontent" style="DISPLAY: none">
选择内容3
</div>
<div class="tabcontent" style="DISPLAY: none">
选择内容4
</div>
<div class="tabcontent" style="DISPLAY: none">
选择内容5
</div>
</div>
网友评论