Klaus Hartl wrote:
Tobias Parent schrieb:
Hey, all -
I've got a strange situation going on with tabs: The first tab in the
list needs to be a 'Show All Links' tab (which will display all of the
other tabs in one long list).
The thing is, using something like this:
-=-=-=-=-=-=-=-=-=-=-=-=-=-
var tabPanel = jQuery(this);
var tabPanelBar = tabPanel.children(":first");
var tabPanelTabs = tabPanel.children(":not(:first)");
tabPanelBar.children(":first").bind("click", function() {
jQuery(this).addClass('active').nextAll().removeClass('active');
showAllTabs();
return false;
});
tabPanelBar.children(":not(:first)").children().bind("click",
function() {
//$.log(jQuery(this).children(":first").html());
alert(jQuery(this).children(":first").html());
tabId = jQuery(this).children(":first").html();
jQuery(this).addClass('active').siblings().removeClass('active');
switchTabs(tabId);
return false;
});
-=-=-=-=-=-=-=-=-=-=-=-=-=-
... which works fine in FireFox, won't work at all in IE6 or Safari. I
think the problem is the :first selector isn't being understood in those
two, but I'm not sure. Looking for input and guidance.
Again, the tricky bit is that a.) it has to work in Safari/IE6, and
that the first tab has to show all tabs. I tried using the tabs UI
plugin, but I can't figure out how to trick it into ignoring the first
tab, so I can manually force that one to do what I want.
Thanks!
-Toby P.
Don't know about your problem, but if you give the UI Tabs another
try, you can utilize the click callback. If that callback returns
false, the tab click gets aborted. So you would have to return false
only in case of the first tab gets clicked:
var $tabs = $('#example').tabs({
click: function() {
if ($tabs.tabsSelected() == 1) return false;
}
});
--Klaus
Thanks, Klaus - and I really enjoyed your presentation at jQueryCamp '07
yesterday! They were all very informative. I'm on information overload
just now!
Regards!
-Toby P.