Selecting a jQuery Tab using a parameter in the URL

前端 未结 5 1004
太阳男子
太阳男子 2020-12-02 23:35

I am currently investigating replacing the tabs provided by a Struts 1 tag library with the tabs provided by jQuery UI. I have successfully managed to get the tabs integrate

5条回答
  •  孤街浪徒
    2020-12-03 00:30

    Using http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2:

    $(document).ready(function(){
        var param = $(document).getUrlParam('selectedTab');
        $('#menu').tabs('select', param);
    });
    

    From documentation:

    #select
    

    Signature:

    .tabs( 'select' , [index] )
    

    Select a tab, as if it were clicked. The second argument is the zero-based index of the tab to be selected or the id selector of the panel the tab is associated with (the tab's href fragment identifier, e.g. hash, points to the panel's id).

提交回复
热议问题