Server : Apache System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : andertr9 ( 1047) PHP Version : 8.2.18 Disable Function : NONE Directory : /home1/andertr9/public_html/wp-content/themes/ssp-starter/js/ |
Upload File : |
/** * jQuery Mobile Menu * Turn unordered list menu into dropdown select menu * version 1.1(27-JULY-2013) * * Built on top of the jQuery library * http://jquery.com * * Documentation * http://github.com/mambows/mobilemenu */ (function($){ $.fn.mobileMenu = function(options) { var defaults = { defaultText: 'Navigate to...', className: 'select-menu', subMenuClass: 'sub-menu', subMenuDash: '–' }, settings = $.extend( defaults, options ), el = $(this); this.each(function(){ var $el = $(this), $select_menu; // ad class to submenu list $el.find('ul').addClass(settings.subMenuClass); // Create base menu var $select_container = $('<div />',{ 'class' : settings.className }).insertAfter( $el ); var $select_menu = $('<select />'); $select_container.append( $select_menu ); if ( settings.defaultText ) { // Create default option $('<option />', { "value" : '#', "text" : settings.defaultText }).appendTo( $select_menu ); } // Create select option from menu $el.find('a').each(function(){ var $this = $(this), optText = ' ' + $this.text(), optSub = $this.parents( '.' + settings.subMenuClass ), len = optSub.length, dash; // if menu has sub menu if( $this.parents('ul').hasClass( settings.subMenuClass ) ) { dash = Array( len+1 ).join( settings.subMenuDash ); optText = dash + optText; } // Now build menu and append it if ( $this.attr( 'href' ) != '#' ) { $('<option />', { "value" : this.href, "html" : optText, "selected" : (this.href == window.location.href) }).appendTo( $select_menu ); } }); // End el.find('a').each // Change event on select element $select_menu.change(function(){ var locations = $(this).val(); if( locations !== '#' ) { window.location.href = $(this).val(); }; }); }); // End this.each return this; }; })(jQuery);