According to Using the JHtmlTabs class in a component, several options may be specified for the tabs being rendered. However, using the example, none of the events fire, and the neither the initial "startOffset" or "useCookie" are respected - the page behaves the same whether this code is there or not with no JS errors indicated.
$options = array(
'onActive' => 'function(title, description){
console.info("Fired OnActive"); // Never fires
description.setStyle("display", "block");
title.addClass("open").removeClass("closed");
}',
'onBackground' => 'function(title, description){
console.info("Fired OnBackground"); // Never fires
description.setStyle("display", "none");
title.addClass("closed").removeClass("open");
}',
'startOffset' => 4, // No tabs are active
'useCookie' => true, // Last active tab is not rememberd
'active' => 'myTabName' // Not in docs, but DOES work
);
Update
Realization that I'm using the tabs with Bootstrap, the code is different for JHtml
// This works, per the docs, and using `tabs.start`, etc.
echo JHtml::_('tabs.start', 'tab_group_id', $options);
echo JHtml::_('tabs.panel', JText::_('PANEL_1_TITLE'), 'panel_1_id');
echo 'Panel 1 content can go here.';
echo JHtml::_('tabs.panel', JText::_('PANEL_2_TITLE'), 'panel_2_id');
echo 'Panel 2 content can go here.';
echo JHtml::_('tabs.end');
// This does NOT work, using `bootstrap.`
echo JHtml::_('bootstrap.startTabSet', 'tab_group_id', $options);
echo JHtml::_('bootstrap.addTab', JText::_('PANEL_1_TITLE'), 'panel_1_id');
echo 'Panel 1 content can go here.';
echo JHtml::_('bootstrap.endTab');
echo JHtml::_('bootstrap.addTab', JText::_('PANEL_2_TITLE'), 'panel_2_id');
echo 'Panel 2 content can go here.';
echo JHtml::_('bootstrap.endTab');
echo JHtml::_('bootstrap.endTabSet');
Has anyone had any luck successfully working with $options
and Bootstrap??