[EMAIL PROTECTED] wrote:
Hi,

Regarding JQuery Tabs (http://stilbuero.de/2006/05/13/accessible-
unobtrusive-javascript-tabs-with-jquery/), is there an elegant way to
add a new tab after the page has loaded and the tabs have already been
constructed?  That is, I have already made this call

                $('#container').tabs(1, {
                     remote: true,
                     fxFade: true,
                     fxSpeed: 'fast',
                     onShow: function(clicked, shown, hidden) {
                        clickTabAction(shown, p_checkForNewTab);
                     }
                });

but now I want to dynamically add another tab to the mix and have it
behave like the others.

Thanks, - Dave


Dave,

there's noting build-in right now, I planned that for Tabs 3 (which unfortunatly won't happen anytime soon).

You need to add the required HTML, unbind click event handlers on the tabs links and do another initialization.

Yeah, I know, not exactly what I'd define as elegant. But you could at least use a little helper for that:


jQuery.fn.newTabs = function(options) {
    $('ul.tabs-nav a', this).unbind('click');
    return this.tabs(options);
};


Usage like normal initialization:

$('#container').newTabs();



-- Klaus



Reply via email to