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

前端 未结 8 790
甜味超标
甜味超标 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:23

    A combination of the other answers here worked for me.

    $( "#tabs" ).tabs({
        create: function(event, ui) {
            window.location.hash = ui.panel.attr('id');
        },
        activate: function(event, ui) {
            window.location.hash = ui.newPanel.attr('id');
        }
    });
    

提交回复
热议问题