1// See original by emre here https://codepen.io/emredenx/pen/ojcxl 2$(document).ready(function ($) { 3 $.fn.menumaker = function (options) { 4 var flexmenu = $(this), settings = $.extend({ 5 format: 'dropdown', 6 sticky: false 7 }, options); 8 return this.each(function () { 9 $(this).find('.button').on('click', function () { 10 $(this).toggleClass('menu-opened'); 11 var mainmenu = $(this).next('ul'); 12 if (mainmenu.hasClass('open')) { 13 mainmenu.slideToggle().removeClass('open'); 14 } else { 15 mainmenu.slideToggle().addClass('open'); 16 if (settings.format === 'dropdown') { 17 mainmenu.find('ul').show(); 18 } 19 } 20 }); 21 flexmenu.find('li ul').parent().addClass('has-sub'); 22 subToggle = function () { 23 flexmenu.find('.has-sub').prepend('<span class="submenu-button"></span>'); 24 flexmenu.find('.submenu-button').on('click', function () { 25 $(this).toggleClass('submenu-opened'); 26 if ($(this).siblings('ul').hasClass('open')) { 27 $(this).siblings('ul').removeClass('open').slideToggle(); 28 } else { 29 $(this).siblings('ul').addClass('open').slideToggle(); 30 } 31 }); 32 }; 33 if (settings.format === 'multitoggle') 34 subToggle(); 35 else 36 flexmenu.addClass('dropdown'); 37 if (settings.sticky === true) 38 flexmenu.css('position', 'fixed'); 39 resizeFix = function () { 40 var mediasize = 768; 41 if ($(window).width() > mediasize) { 42 flexmenu.find('ul').show(); 43 } 44 if ($(window).width() <= mediasize) { 45 flexmenu.find('ul').hide().removeClass('open'); 46 } 47 }; 48 resizeFix(); 49 return $(window).on('resize', resizeFix); 50 }); 51 }; 52 53 $('#flexmenu').menumaker({ format: 'multitoggle' }); 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.