Next-Prev functionality for the jquery tabs

后端 未结 3 893
傲寒
傲寒 2021-01-24 03:39

I need Next, Previous functionality for the jquery tabs on clicking on the Next and Prev html buttons. I am using jquery.1.9.1.js and jquery-ui-1.10.2.custom.

3条回答
  •  忘了有多久
    2021-01-24 04:36

    This works for me:

    $( "#ui-tabs" ).tabs();
    
     function GetSelectedTabIndex() {
            return $('#ui-tabs').tabs('option', 'selected');
     }
    
    function ShowTabs(stepNum) {
        var num = parseInt(stepNum);
        $('#ui-tabs').tabs('option', 'active', parseInt(GetSelectedTabIndex()) + num);
    }
    

    It seems to me that there's no point in using the $tabs variable, as it's local to your GetSelectedTabIndex function, and it's only used once per function call...

    Demo: http://jsfiddle.net/darkajax/A8ejN/

提交回复
热议问题