开发者

jquery - tabbed interface problems in ff, ie

trying to use a tabbed interface on the portfolio section of my site using jquery.

all that i need achieve is adding the class 'active' to the li element when the user clicks that tab's link. thought my coding was quite typical, though can only get it to work in google chrome and safari. firefox and internet explorer adds 'active' class to first li, removes it on click of another tab, but does not add 'active' to the tab clicked.

code:

$(document).ready(function(){                          
    $('#tabbed-interface li:first').addClass('active');
    $('#tabbed-interface>ul>li>a').click(f开发者_如何学JAVAunction(){
        $('#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();
}); 


for FF to works, you just need to add "event" inside function() like :

$('#tabbed-interface>ul>li>a').click(function(event){


Maybe consider changing this line:

$(event.target).parent().addClass('active');

to be

$(this).parent().addClass('active');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜