0
我不知道爲什麼我的標籤無法正常工作 我一直在使用它幾個小時了! https://jsfiddle.net/mshgwjrb/我的標籤無法正常工作
$('.tabs').each(function() {
var $this = $(this);
var $active = $this.find('li .active');
var $link = $active.find('a');
var $activeTab = $($link.attr('href'));
$this.on('click', '.tab-', function (e) {
e.preventDefault();
var currLink = $(this);
var id = this.hash;
if (!currLink.is('.active')) {
$activeTab.removeClass('active');
$active.removeClass('active');
$(id).addClass('active');
currLink.parent().addClass('active');
}
});
});
有一個關於'李.active'一個錯字,你想'li.active'針對任何LI與'.active'類 – adeneo
你有什麼建議? –
S/he建議您將您的拼寫錯誤從'li .active'修復爲'li.active' – 8protons