Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For <strong>jQuery UI 1.10</strong> and later <code>show</code> has been deprecated in favor of <code>activate</code>. Also <code>id</code> is no longer valid jQuery. Use <code>.attr('id')</code> instead. Finally, use <code>on('tabsactivate')</code> instead of <code>bind()</code>.</p> <pre><code>$(function() { $("#tabs").tabs({ activate: function(event, ui) { window.location.hash = ui.newPanel.attr('id'); } }); }); </code></pre> <p>Post-creation method:</p> <pre><code>$("#myTabs").on( "tabsactivate", function(event, ui) { window.location.hash = ui.panel.id; }); </code></pre> <p>Demo: <a href="http://jsfiddle.net/RVHzV/" rel="noreferrer">http://jsfiddle.net/RVHzV/</a></p> <p>Observable result: <a href="http://jsfiddle.net/RVHzV/show/light/" rel="noreferrer">http://jsfiddle.net/RVHzV/show/light/</a></p> <p><strong>Earlier Version of JQuery</strong></p> <p>Add a handler to your tab call to update the location hash with the tab id:</p> <pre><code>$("#myTabs").tabs({ // options ... show: function(event, ui) { window.location.hash = ui.panel.id; } }); </code></pre> <p>You can also add this after your UI Tabs are created:</p> <pre><code>$("#myTabs").bind( "tabsshow", function(event, ui) { window.location.hash = ui.panel.id; }); </code></pre> <p>Code demo: <a href="http://jsfiddle.net/jtbowden/ZsUBz/1/" rel="noreferrer">http://jsfiddle.net/jtbowden/ZsUBz/1/</a></p> <p>Observable result: <a href="http://fiddle.jshell.net/jtbowden/ZsUBz/1/show/light/" rel="noreferrer">http://fiddle.jshell.net/jtbowden/ZsUBz/1/show/light/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload