I've been using the jQuery UI tabs for a bit now and an interesting request has come up. The current tab setup is using the rotation feature. I need to find a way to determine if the tab is shown because of the result of the rotation itself, or because a user physically clicked the tab.
I've wired up all of the standard events, show and select and they fire regardless of the source of the tab change.
Does anyone have any ideas? Basically I'd like to do something additional if the user clicked the tab, but not if the tab changes by itself via the rotation.
If I wire up the click even to the tabs themselves it doesn't seem to get fired at all, I'm assuming because the tabs widget is using that event itself.
Edit: here's the basic code
<script type="text/javascript">
$(document).ready(function(){
$("#featured").tabs(
{show: function(e, ui) { console.log(e);} }
).tabs("rotate", 5000, false);
});
</script>
The console will show the event (e) whether it is clicked by the user or shown as part of the rotation. Also, the same if I change the event from show: to select: