1/* 2 3Responsive Mobile Menu v1.0 4Plugin URI: responsivemobilemenu.com 5 6Author: Sergio Vitov 7Author URI: http://xmacros.com 8 9License: CC BY 3.0 http://creativecommons.org/licenses/by/3.0/ 10 11*/ 12 13function responsiveMobileMenu() { 14 $('.rmm').each(function() { 15 16 17 $(this).children('ul').addClass('rmm-main-list'); // mark main menu list 18 19 20 var $style = $(this).attr('data-menu-style'); // get menu style 21 if ( typeof $style == 'undefined' || $style == false ) 22 { 23 $(this).addClass('graphite'); // set graphite style if style is not defined 24 } 25 else { 26 $(this).addClass($style); 27 } 28 29 30 /* width of menu list (non-toggled) */ 31 32 var $width = 0; 33 $(this).find('ul li').each(function() { 34 $width += $(this).outerWidth(); 35 }); 36 37 // if modern browser 38 39 if ($.support.leadingWhitespace) { 40 $(this).css('max-width' , $width*1.05+'px'); 41 } 42 // 43 else { 44 $(this).css('width' , $width*1.05+'px'); 45 } 46 47 }); 48} 49function getMobileMenu() { 50 51 /* build toggled dropdown menu list */ 52 53 $('.rmm').each(function() { 54 var menutitle = $(this).attr("data-menu-title"); 55 if ( menutitle == "" ) { 56 menutitle = "Menu"; 57 } 58 else if ( menutitle == undefined ) { 59 menutitle = "Menu"; 60 } 61 var $menulist = $(this).children('.rmm-main-list').html(); 62 var $menucontrols ="<div class='rmm-toggled-controls'><div class='rmm-toggled-title'>" + menutitle + "</div><div class='rmm-button'><span> </span><span> </span><span> </span></div></div>"; 63 $(this).prepend("<div class='rmm-toggled rmm-closed'>
63"+$menucontrols+"<ul>"+$menulist+"</ul></div>"); 64 65 }); 66} 67 68 69 70$(function() { 71 72 responsiveMobileMenu(); 73 getMobileMenu(); 74 75 76 /* slide down mobile menu on click */ 77 78 $('.rmm-toggled, .rmm-toggled .rmm-button').click(function(){ 79 if ( $(this).is(".rmm-closed")) { 80 $(this).find('ul').stop().show(300); 81 $(this).removeClass("rmm-closed"); 82 } 83 else { 84 $(this).find('ul').stop().hide(300); 85 $(this).addClass("rmm-closed"); 86 } 87 88 }); 89 90}); 91 /* hide mobile menu on resize */
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.