jQuery UI tabs, update url when clicking on a different tab

前端 未结 8 771
甜味超标
甜味超标 2020-12-09 11:56

I\'m using the tabs of jQuery UI: http://jqueryui.com/demos/tabs/

How to update the current url of the browser when the user click on a different ta

8条回答
  •  自闭症患者
    2020-12-09 12:18

    I used this method within my jQuery responsive tabs to hash the url with the active tab.

    $(function() {
           $('#tabs, #subtabs').responsiveTabs({
                activate: function(event, ui) {
                window.location.hash = $("ul li.r-tabs-state-active a").attr("href");
            },
            startCollapsed: 'accordion'
           });
    });
    

提交回复
热议问题