I’m using this plugin for tabs – https://github.com/JangoSteve/jQuery-EasyTabs
In turn, it uses this plugin for it’s hash changes – http://benalman.com/projects/jquery-hashchange-plugin/
I’ve set it up by doing the following –
$('#tab-container').easytabs().bind('easytabs:after', function(evt, tab, panel, data) {
alert('DO SOMETHING!')
});
This results in an alert being called when a tab is clicked.
The issue that I’m having is that the call back is not firing on page load.
If I visit – http://www.mitesite.com#mytabid – the plugin will read the hash value in the url and set the correct tab, but it will not fire the callback.
Any idea how I should fix this?
You could trigger the
onhashchangeevent on page load. This will ensure that whatever function is bound to your hashchange event will be fired on page load.