试图在我的网站的投资组合部分使用jquery使用选项卡式界面。jquery - ff中的选项卡式界面问题,例如
我需要的所有东西都是当用户单击该选项卡的链接时,将类'活动'添加到li元素。我认为我的代码很典型,但只能在谷歌浏览器和Safari浏览器中运行。 firefox和IE浏览器会向第一个li添加“活动”类,在点击另一个标签时移除它,但不会将“活动”添加到单击的选项卡中。
代码:
$(document).ready(function(){
$('#tabbed-interface li:first').addClass('active');
$('#tabbed-interface>ul>li>a').click(function(){
$('#tabbed-interface>ul>li').removeClass('active');
$(event.target).parent().addClass('active');
$('#tabbed-interface>div').fadeOut(250).filter(this.hash).fadeIn(250);
return false;
});
$('#tabbed-interface>div').css('position','absolute').not(':first').hide();
});