You can close (as in unselected) a tab via deselectable option:

$('#example').tabs({ deselectable: true });

Then if you click on the selected tab, it'll become inactive. You can
as well trigger that with tabs('select'):

$('#example').tabs('select', $('#example').data('selected.tabs')); //
unselects the active tab


--Klaus



On 6 Nov., 11:59, nmendes <[EMAIL PROTECTED]> wrote:
> Klaus,
>
> You are right, sorry, it was just my personal interpretation of the
> question, and that's because I've hit on the same problem and browsed
> the web and found no solution. The removal of tabs are well documented
> (and that's why I thought he meant another thing), but I've found no
> easy solution to close the open tab (as in hide whichever tab is
> opened at the moment).
>
> NM
>
> On Nov 6, 6:39 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > I simply interpreted "close" in the way what Firefox does, if you
> > close a tab and tried to come up with a solution. You may be right,
> > but it probably doesn't make much sense to speculate about what led
> > may have wanted...
>
> > --Klaus
>
> > On 5 Nov., 19:55, nmendes <[EMAIL PROTECTED]> wrote:
>
> > > Klaus,
>
> > > That method will REMOVE the tabs, and not closing them. The tabs will
> > > no longer function.
> > > I think led meant to close the tabs but be able to open them later.
>
> > > - NM
>
> > > On Nov 5, 4:03 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > > > Close all tabs:
>
> > > > $('.ui-tabs-nav').each(function() {
> > > >     var $tabs = $(this);
> > > >     for (var i = 0, tabs = $tabs.tabs('length'); i < tabs; i++) {
> > > >             $tabs.tabs('remove', i);
> > > >     });
>
> > > > });
>
> > > > If you want to allow only one tab open you could hook into select, so
> > > > that with every tab select you would close all other open tabs:
>
> > > > var tabs = $('#foo, #bar, #baz').tabs({
> > > >     deselectable: true,
> > > >     selected: false,
> > > >     select: function(e, ui) {
> > > >         var ul = $(ui.tab).parents('ul:first');
> > > >         $.each(tabs, function(i, el) {
> > > >             if (el != ul) {
> > > >                 $(el).tabs('select', $(el).data('selected.tabs'));
> > > >             }
> > > >         });
> > > >     }
>
> > > > });
>
> > > > Both untested.
>
> > > > --Klaus
>
> > > > On 5 Nov., 15:56, led <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi.My first post about jquery.
> > > > > The question is how can i reference all ui.tabs objects in a page and
> > > > > close all tabs from all ui tabs.
> > > > > It's that i have tabs generated from a databse results query and i
> > > > > need to close all tabs from all ui.tabs before i open another. Or a
> > > > > way to prevent opening more than one tab per page.
>
> > > > > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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