function om_maximenu_active_js in OM Maximenu 6
Same name and namespace in other branches
- 8 inc/om_maximenu.effects.inc \om_maximenu_active_js()
- 7 inc/om_maximenu.effects.inc \om_maximenu_active_js()
Make menus active when submenus are active
1 call to om_maximenu_active_js()
- om_maximenu_init in inc/
om_maximenu.render.inc - Implementation of hook_init().
File
- inc/
om_maximenu.effects.inc, line 522 - OM Maximenu Effects
Code
function om_maximenu_active_js($menu = NULL, $animated_bg = 0, $tabbed = NULL) {
$active = 'active-trail';
$lava = 'selectedLava';
$class = $animated_bg ? $lava : $active;
$active_js = "\n \$(document).ready(function() {\n \$.each(\$('#om-menu-" . $menu . " .om-leaf'),function() {\n\n var active = \$('.menu a', this).hasClass('active');\n var active_trail = \$('.menu a', this).hasClass('active-trail');\n \n if ((active == true) || (active_trail == true)) {\n \$('#om-menu-" . $menu . " .om-leaf').removeClass('" . $class . "');\n \$(this).addClass('" . $class . "');\n }\n });\n }); ";
$active_tabbed_js = "\n \$(document).ready(function() {\n \$.each(\$('#om-menu-" . $menu . " .om-leaf'),function() {\n var leafId = \$(this).attr('id');\n var tabbedContentId = leafId.replace('leaf', 'tabbed-content');\n var active_tabbed = \$('ul li a', '.om-maximenu-tabbed-content #' + tabbedContentId).hasClass('active');\n \n var active = \$('ul li a', this).hasClass('active');\n \n if ((active_tabbed == true) || (active == true)) {\n \$('#om-menu-" . $menu . " .om-leaf').removeClass('" . $class . "');\n \$(this).addClass('" . $class . "');\n }\n });\n }); ";
if ($tabbed == NULL) {
drupal_add_js($active_js, "inline");
}
else {
drupal_add_js($active_tabbed_js, "inline");
}
}