PageSourceSearch

http://www.linhson.org.tw/cn/wp-content/themes/UniEducation/lib/js/jquery.mobilemenu.js?ver=4.6.29

js linhson.org.tw collected 2026-10-07 22:16:33 UTC 1,933 bytes, 81 lines download raw bytes

1/**
2 * jQuery Mobile Menu 
3 * Turn unordered list menu into dropdown select menu
4 * version 1.0(31-OCT-2011)
5 * 
6 * Built on top of the jQuery library
7 *   http://jquery.com
8 * 
9 * Documentation
10 * 	 http://github.com/mambows/mobilemenu
11 */
12(function($){
13$.fn.mobileMenu = function(options) {
14	
15	var defaults = {
16			defaultText: 'Navigate to...',
17			className: 'select-menu',
18			containerClass: 'select-menu-container',
19			subMenuClass: 'sub-menu',
20			subMenuDash: '–'
21		},
22		settings = $.extend( defaults, options ),
23		el = $(this);
24	
25	this.each(function(){
26		// ad class to submenu list
27		el.find('ul').addClass(settings.subMenuClass);
28
29        // Create base menu
30		$('<div />',{
31			'class' : settings.containerClass
32		}).insertAfter( el );
33        
34		// Create base menu
35		$('<select />',{
36			'class' : settings.className
37		}).appendTo( '.' + settings.containerClass );
38
39		// Create default option
40		$('<option />', {
41			"value"		: '#',
42			"text"		: settings.defaultText
43		}).appendTo( '.' + settings.className );
44
45		// Create select option from menu
46		el.find('a').each(function(){
47			var $this 	= $(this),
48					optText	= '&nbsp;' + $this.text(),
49					optSub	= $this.parents( '.' + settings.subMenuClass ),
50					len			= optSub.length,
51					dash;
52			
53			// if menu has sub menu
54			if( $this.parents('ul').hasClass( settings.subMenuClass ) ) {
55				dash = Array( len+1 ).join( settings.subMenuDash );
56				optText = dash + optText;
57			}
58
59			// Now build menu and append it
60			$('<option />', {
61				"value"	: this.href,
62				"html"	: optText,
63				"selected" : (this.href == window.location.href)
64			}).appendTo( '.' + settings.className );
65
66		}); // End el.find('a').each
67
68		// Change event on select element
69		$('.' + settings.className).change(function(){
70			var locations = $(this).val();
71			if( locations !== '#' ) {
72				window.location.href = $(this).val();
73			};
74		});
75
76	}); // End this.each
77
78	return this;
79
80};
81})(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.