我有這個很基本的選項卡式塊:淡入淡出效果的onclick(jQuery的)
$('.tabbed-section .panel').hide();
$('.tabbed-section .panel:first').show();
$('.tabbed-section .tabs li:first').addClass('active');
$('.tabbed-section .tabs li a').click(function() {
$('.tabbed-section .tabs li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
var tab_id = $(this).attr('href');
$(this).closest('#hero').attr('class', 'clear ' + tab_id.replace('#', ''));
$('.tabbed-section .panel').hide();
$(currentTab).show();
return false;
});
..它的偉大工程,但我可以添加淡入淡出效果的活動標籤的變化是什麼時候?我認爲它有一個插件(innerfade),但我想避免使用另一個插件,如果可能的話。
另外,上面的jQuery可以進一步壓縮嗎?
感謝您的幫助!
你可能不想這樣做,因爲他們都會同時做動畫,並且可能會破壞佈局,因爲他們都可以看到一段時間。最好使用fadeOut,IMO的完成回調。 – rfunduk 2010-01-04 12:11:18
實際上,這很有效,事實上,代碼在一瞬間破壞了佈局。 – 3zzy 2010-01-04 12:14:41