Associate an element placed out of tab with tab items
I have a tab script that works:
http://jsfiddle.net/fmqeh/8/
With click on ".开发者_开发技巧tab" items, ul.tab li items has class "actives". But with click on
<a class="bdn" href="#tab2">Go to Tab 2</a>
<a class="bdn"> couldnt add  class="actives to tab items. How can I do this with scroll to 
<div class="tab_content chart" id="tab2">
    this is the content of tab2
</div>
Thanks in advance
It's a lot easier if you just trigger the click event on the tab you want to activate:
$(".bdn").click(function(e) {
    var $tabs = $('ul.tab');
    $tabs.find('a[href="#tab2"]').click();
    $(window).scrollTop($tabs.offset().top);
    e.preventDefault();
});
Your fixed demo: http://jsfiddle.net/fmqeh/11/
I think your selector should be:
 $("ul.tab li:nth-child(2)").addClass("actives");
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论