UI Tabs aka Tabs 3 - nearly there - two questions (Paul, John)

UI Tabs aka Tabs 3 - nearly there - two questions (Paul, John)


Hi all,
I think I have nearly finished the tabs for UI.
Paul, I have a question regarding the callbacks, what's the prefered way
to do it?
Variant 1 (specify callback, currently implemented):
$('#tabs').addTab('#new', 'New', function(disabled) {
//do something
});
Variant 2 (general callback):
$('#tabs').tabs({
disabled: function(disabled) {
// do something
}
});
$('#tabs').addTab('#new', 'New');
I do already have the second approach for click, hide, show events.
Maybe I got a little confused.
Maybe supply even both approaches for maximum flexibility?
Second question: John, I /think/ I read somewhere that documentation
should not go into the file any longer but directly into the wiki. Is
that correct? I can't find that mail...
I will work on documentation and demo and will try to get as much ready
as I can this weekend!
What's new you may wonder (all of it frequently requested features,
except for the last two):
* Adding, removing tabs on the fly
* Automatic type detection (Ajax, inline) - allows mixed tabs for example
* caching option for Ajax tabs (load once, but lazy)
* reload Ajax tabs programmatically, also the ability to set a new url
via $('#tabs').load(2, newUrl)
* much more flexible HTML, all that is required now is a <ul>/<ol> with
some links as a starting point (as in other tabs implementations) - no
more container required
* option to allow toggle visibility when clicking a currently selected tab
* option for starting with all tabs unselected
* removed autoheight option (it was ugly) - I think that can easily be
achieved with CSS alone and this option was often mistaken as being a
CSS substitute anyway.
* Class based, with the benefit of easier extensibility. Need your own
special tabs method? Easy, for example create a rotate function:
$.extend($.ui.tabs.prototype, {
rotate: function() {
console.log(this.$tabs);
console.log(this.$containers);
// let them rotate...
}
}
Yeah, that's just the pattern we're using in UI but for average Tabs
users that's new of course.
You could then do:
$('ul#tabs').each(function() {
var instance = $.ui.tabs.instances[this.jQueryTabsInstanceKey];
instance.rotate();
});
I really like that!
I should note that I have left away history support for now. The history
plugin does not work in Safari 3 currently and Opera also recently
introduced a bug that makes history fail as well (the location.hash
property doesn't change even if you change it by clicking on such a
link). That said, I'm planning a complete overhaul of the history plugin
to be released as part of UI (?) later.
--Klaus