先前有群友询问js操作Tab选项卡问题,于此贴上一份。
方式一:
$(".tableTitle p").click(function(){
$(".tableTitle p").eq($(this).index()).addClass("active").siblings().removeClass('active');
$(".tableListContent").hide().eq($(this).index()).show();
});
tableTitle p要点击的对象
active是点击后改变颜色的样式
tableListContent 点击后显示的对象
方式二:
$('.tableTitle p:eq(0)').click(function(){
$('.tableTitle p').removeClass()
$(this).addClass('active')
$('.tableListContent ').hide()
$('.tableListContent:eq(0)').fadeIn()
})
··········