jquery实现tab选项卡
<section class="recommendarticlelist">
<hgroupclass="clearfix">
<h2>热点推荐</h2>
<h3>
<spandata-index="0">婚纱礼服</span>
<spandata-index="1">婚庆时尚</span>
<spandata-index="2"class="">婚纱礼服</span>
<spandata-index="3"class="">蜜月</span>
<spandata-index="4"class="">蜜月国内</span>
</h3>
</hgroup>
<divclass="recommendarticlelist-c">
<uldata-index="0"class="clearfix">
<li>
22
</li>
</ul>
<uldata-index="1"class="clearfix">
<li>
333
</li>
</ul>
<uldata-index="2"class="clearfix">
<li>
444
</li>
</ul>
<uldata-index="3"class="clearfix">
<li>
555
</li>
</ul>
<uldata-index="4"class="clearfix">
<li>
666
</li>
</ul>
</div>
</section>$('.recommendarticlelist h3 span').click(function () {
var tab = $(this);
if (!tab.hasClass('selected')) {
var currentIndex = tab.siblings('.selected').data('index');
tab.addClass('selected');
tab.siblings('.selected').removeClass('selected');
var index = tab.data('index');
var articleList = $('.recommendarticlelist-c ul');
articleList.filter('[data-index=' + currentIndex + ']').css('display', 'none');
articleList.filter('[data-index=' + index + ']').css('display', 'block');
}
});
$('.recommendarticlelist h3 span:first').click();
相关推荐
APCDE 2020-06-11
viewerlin 2020-05-25
adc00 2020-01-04
老高 2019-12-30
luoj 2011-09-13
xiaoguolaoshi 2008-07-20
Rgenxiao 2011-09-08
支离破碎 2014-06-30
qiuhaotc 2012-02-19
85931235 2012-03-28
bruceli 2019-05-14
南城小伙 2019-06-10
逆风飞舞0 2019-05-14
87530399 2014-05-26
chenyangah 2017-03-31
84236532 2016-11-17
zhangpuego 2016-07-16
Jiminull 2016-03-03