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

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

    This should get what you want (using jQuery UI 1.8, in version 1.9 and later use the activate event, see other answers for code example). I used the sample HTML in jQuery UI demos;

            $( "#tabs" ).tabs({
                select: function(event, ui) {                   
                    window.location.hash = ui.tab.hash;
                }
            });
    

提交回复
热议问题