I'm aware that there's an option to change the tab switching speed ("Effect speed") located at Admin > Site configuration > Tabs. However, even the "fast" option isn't fast enough for me. Here's a quick code change to make the switching [almost] immediate...
Open tabs.module
Line 71:
Original: '#options' => array('slow' => t('slow'), 'fast' => t('fast')),
New: '#options' => array('slow' => t('slow'), 'fast' => t('fast'), '1' => 'immediate'),
Line 178:
Original Code:
if (!$loaded) {
$path = drupal_get_path('module', 'tabs');
drupal_add_js($path . '/ui.tabs.js');
drupal_add_js($path . '/tabs.js');
drupal_add_js(array('tabs' => array('slide' => (bool) variable_get('tabs_slide', 0), 'fade' => (bool) variable_get('tabs_fade', 0), 'speed' => variable_get('tabs_speed', 'slow'), 'auto_height' => (bool) variable_get('tabs_auto_height', 0), 'next_text' => variable_get('tabs_nav_next', t('next')), 'previous_text' => variable_get('tabs_nav_prev', t('previous')))), 'setting');
New Code:
if (!$loaded) {
$tabs_speed = variable_get('tabs_speed', 'slow');
if (is_numeric($tabs_speed))
$tabs_speed = (int)$tabs_speed;
$path = drupal_get_path('module', 'tabs');
drupal_add_js($path . '/ui.tabs.js');
drupal_add_js($path . '/tabs.js');
drupal_add_js(array('tabs' => array('slide' => (bool) variable_get('tabs_slide', 0), 'fade' => (bool) variable_get('tabs_fade', 0), 'speed' => $tabs_speed, 'auto_height' => (bool) variable_get('tabs_auto_height', 0), 'next_text' => variable_get('tabs_nav_next', t('next')), 'previous_text' => variable_get('tabs_nav_prev', t('previous')))), 'setting');
In jQuery, "slow" is defined as 600 milliseconds, and "fast" is defined as 200 milliseconds. The code above essentially defines an additional option for "immediate" which is 1 millisecond.
I'm sure this code could be improved upon to add an "other" option along with a textbox for users to type in the exact number of milliseconds they want.
Comments
Comment #1
nedjoThanks, applied.