Collapsable tabs: How to detect if's there's an open tab
Hi,
I have a collapsable tab like this:
- $("#tabs").tabs({
collapsible: true,
selected: -1,
fx: { opacity:'toggle', duration: 120 },
select: function(event, ui) {
// do something, only when no tab is open
}});
Say, I have three tabs and no tab open on start. Everything's ok when I open a tab, click on another one, and so on. But when I click on the currently open tab to close it I want something to happen. e.g. a message "all tabs have been closed" to appear somewhere. How can I achieve this? The problem is, I thought I could use
- $('#tabs-right').tabs('option', 'selected') == -1
within the select callback-function to detect if there is still one open or not, but it returns the state before the select action is done. This means, it returns -1 if there was no tab open BEFORE and therefore it's not possible to distinguish between a click on another tab or a click on the same (because both return the index of a tab > 0).
It's hard to explain, but I hope you know what I mean.
Is there a way to solve this?