我有这个很基本的选项卡式块:淡入淡出效果的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