在给出的示例中,我使用“.active”和“.inactive”类,但我只想显示“.active”应用 “.inactive”,我怎样才能从代码的情况只显示类到活动选项卡没有类休息选项卡
//------ Tabs
$('#tabs li:first-child a').addClass('active');
$('#tabs li a:not(:first)').addClass('inactive');
$('.tab-container').hide();
$('.tab-container:first').show();
$('#tabs li a').click(function(){
var t = $(this).attr('id');
if(!$(this).hasClass('active')){ //this is the start of our condition
$('#tabs li a').removeClass('active').addClass('inactive');
$(this).removeClass('inactive').addClass('active');
$('.tab-container').hide();
$('#'+ t + 'C').fadeIn('slow');
}
});
你需要https://jsfiddle.net/v78se1b6/吗? – Satpal