1/** 2 * @file 3 * Integrate codrops' ResponsiveMultiLevelMenu library with Responsive Menus. 4 */ 5(function ($) { 6 Drupal.behaviors.responsive_menus_codrops_responsive_multi = { 7 attach: function (context, settings) { 8 settings.responsive_menus = settings.responsive_menus || {}; 9 var $windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 10 $.each(settings.responsive_menus, function(ind, iteration) { 11 if (iteration.responsive_menus_style != 'codrops_responsive_multi') { 12 return true; 13 } 14 if (!iteration.selectors.length) { 15 return; 16 } 17 // Only apply if window size is correct. Runs once on page load. 18 var $media_size = iteration.media_size || 768; 19 if ($windowWidth <= $media_size) { 20 // Call codrops ResponsiveMultiLevelMenu with our settings. 21 $(iteration.selectors).once('responsive-menus-codrops-multi-menu', function() { 22 $(this).prepend('<button class="dl-trigger">Open Menu</button>'); 23 // Removing other classes / IDs. 24 $(this) 25 .attr('class', 'dl-menuwrapper') 26 .attr('id', 'dl-menu') 27 .css('z-index', '999'); 28 // Find the parent ul. 29 var $parent_ul = $(this).find('ul:not(.contextual-links)').first(); 30 $parent_ul 31 .attr('class', 'dl-menu') 32 .attr('id', 'rm-dl-menu') 33 .find('li').removeAttr('id').removeAttr('class') 34 .find('a').removeAttr('id').removeAttr('class'); 35 // Add submenu classes. 36 $parent_ul.find('ul').each(function(subIndex, subMenu) { 37 $(this).removeAttr('id').attr('class', 'dl-submenu'); 38 $subnav_link = $(this).parent('li').find('a').first()[0].outerHTML; 39 $(this).prepend('<li>' + $subnav_link + '</li>'); 40 }); 41 // Call the ResponsiveMultiLevelMenu dlmenu function. 42 $(this).dlmenu({ 43 animationClasses : { 44 classin : iteration.animation_in || 'dl-animate-in-1', 45 classout : iteration.animation_out || 'dl-animate-out-1' 46 } 47 }); 48 }); 49 } 50 51 }); 52 53 } 54 }; 55}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.