function _simplemenu_add_js in SimpleMenu 6
Same name and namespace in other branches
- 7 simplemenu.module \_simplemenu_add_js()
\brief Add the JavaScript that makes it all work.
This function adds the Simplemenu JavaScript, the Superfish JavaScript and settings from the user.
1 call to _simplemenu_add_js()
- simplemenu_init in ./
simplemenu.module - Implementation of hook_init().
File
- ./
simplemenu.module, line 258 - Creates a simplemenu.
Code
function _simplemenu_add_js() {
$simplemenu_path = drupal_get_path('module', 'simplemenu');
// Settings
$fix = variable_get('simplemenu_fix', 'scroll');
switch ($fix) {
case 'top':
$element = 'body';
$placement = 'prepend';
break;
case 'bottom':
$element = 'body';
$placement = 'append';
break;
default:
// 'scroll'
// let user defined other elements when not fixed
$element = variable_get('simplemenu_element', 'body');
$placement = variable_get('simplemenu_element_method', 'prepend');
break;
}
$settings = array(
'effect' => variable_get('simplemenu_effect', 'opacity'),
'effectSpeed' => variable_get('simplemenu_effect_speed', 'fast'),
'element' => $element,
'placement' => $placement,
'hideDelay' => variable_get('simplemenu_hide_delay', 800),
'detectPopup' => variable_get('simplemenu_detect_popup', 1),
);
drupal_add_js(array(
'simplemenu' => $settings,
), 'setting');
// Simplemenu
drupal_add_js($simplemenu_path . '/simplemenu.js');
// Superfish
$superfish = variable_get('simplemenu_superfish_version', 'superfish-1.4.1.js');
if ($superfish != 'custom') {
drupal_add_js($simplemenu_path . '/' . $superfish);
}
}