You are here

function om_maximenu_link_slider in OM Maximenu 8

Same name and namespace in other branches
  1. 6 inc/om_maximenu.effects.inc \om_maximenu_link_slider()
  2. 7 inc/om_maximenu.effects.inc \om_maximenu_link_slider()

Animated Link slider

1 call to om_maximenu_link_slider()
om_maximenu_asset_loader in inc/om_maximenu.render.inc
Loads styles and js

File

inc/om_maximenu.effects.inc, line 347
OM Maximenu Effects

Code

function om_maximenu_link_slider($menu = NULL) {
  $link_slide_js = "\n    jQuery(document).ready(function(\$) {\n      linkHeight = \$('#om-menu-" . $menu . " .om-leaf').height();\n  \n      \$('#om-menu-" . $menu . " .om-leaf').css('height', linkHeight + 'px');\n      \$('#om-menu-" . $menu . " .om-leaf .om-link').css('overflow', 'hidden').css('height', 0);      \n\t    \$('#om-menu-" . $menu . " .om-leaf').prepend('<span class=\"om-link-slider\"></span>'); \n\n\t    \$('#om-menu-" . $menu . " .om-leaf').each(function() { \n\t\t    var textLink = \$(this).find('.om-link').text(); \n\t\t    \$(this).find('span.om-link-slider').show().text(textLink); \n\t    }); \n\n\t    \$('#om-menu-" . $menu . " .om-leaf').hover(\n\t      function() { \n\t        \$(this).find('span.om-link-slider').stop().animate({ lineHeight: 0, height: 0 }, 250);\n\t        \$(this).find('.om-link').stop().animate({ height: linkHeight }, 250); \n\t      },\n\t      function() { \n\t        \$(this).find('span.om-link-slider').stop().animate({ lineHeight: linkHeight, height: linkHeight }, 250);\n\t        \$(this).find('.om-link').stop().animate({ height: 0 }, 250);\n\t    });\n    });\n  ";
  drupal_add_js($link_slide_js, "inline");
}