Klaus ... I guess I still have questions about how this will work.  I
understand how "one" event works (sortof), but since the tabs are
being added dynamically (ajax tabs), I don't have any tab id to be
able to select with.  In theory I suppose that would work if all the
tabs were pre-existing with the page, but not in my case.

Perhaps if I describe the behavior I'm looking for, you (or someone)
can guide me in the right direction...

1.  The user will select an item from a menu (a link) and upon
clicking it, a new tab will open with the requested page inside.

2.  The user can open multiple tabs, each containing a different
document/page/script/ etc., but not multiples of the same item.

3.  If the user selects an item from the menu that is already open,
the existing tab should become selected.

4.  If the user closes a tab, the menu item will then need to create a
new tab if the item is selected again... and so on.

Does this make sense at all?  It's typical application type behavior
and I'm really struggling to figure out how to make this happen.

pseudo:

function itemclick(var taburl) {
if (tab_already_open()) {
   selecttab();
} else {
   opentab(taburl);
}
}

Thank you for your help Klaus!

--Chris



On Jan 26, 8:40 am, Klaus Hartl <[email protected]> wrote:
> On 25 Jan., 19:04, csb92376 <[email protected]> wrote:
>
> > SO... how do I select the newly added tab?  The example code in the
> > tabs FAQ doesn't do anything, and I'm having a very hard time trying
> > to figure out how that example code works anyway. (I'm new to jquery
> > and half this stuff is still voodoo to me)
>
> The example from the FAQ works fine for me. Make sure that you're
> using jQuery UI 1.6rc5 together with jQuery 1.3.1 or jQuery UI 1.5.3
> with jQuery 1.2.6 - other combinations are not supported.
>
> > Also in addition to automatically selecting a newly added tab, I also
> > need to select a tab if the user has already opened a link in a tab.
> > Subsequent clicks on the same link should select the existing tab
> > rather than open multiple copies of it.  Is this possible?
>
> You could use the "one" bind method for that, e.g. the tab is created
> once and afterwards another click event is bound to select the tab
> from that point on. Just an outline, untestet:
>
> $('a.whatever').one('click', function() {
>     // add tab
>     ...
>     // bind new handler to select a tab instead of creating from now
> on
>     $(this).click(function() {
>         // select the tab here
>         ...
>         return false;
>     });
>
> });
>
> --Klaus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to