PageSourceSearch

https://confidentdentalcare.co.uk/Scripts/responsivemobilemenu.js

js confidentdentalcare.co.uk collected 2026-10-08 21:40:51 UTC 2,607 bytes, 112 lines download raw bytes

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			
18			$(this).children('ul').addClass('rmm-main-list');	// mark main menu list
19			
20			
21			var $style = $(this).attr('data-menu-style');	// get menu style
22				if ( typeof $style == 'undefined' ||  $style == false )
23					{
24						$(this).addClass('graphite'); // set graphite style if style is not defined
25					}
26				else {
27						$(this).addClass($style);
28					}
29					
30					
31			/* 	width of menu list (non-toggled) */
32			
33			var $width = 0;
34				$(this).find('ul li').each(function() {
35					$width += $(this).outerWidth();
36				});
37				
38			// if modern browser
39			
40			if ($.support.leadingWhitespace) {
41				$(this).css('max-width' , $width*1.05+'px');
42			}
43			// 
44			else {
45				$(this).css('width' , $width*1.05+'px');
46			}
47		
48	 	});
49}
50function getMobileMenu() {
51
52	/* 	build toggled dropdown menu list */
53	
54	$('.rmm').each(function() {	
55				var menutitle = $(this).attr("data-menu-title");
56				if ( menutitle == "" ) {
57					menutitle = "Menu";
58				}
59				else if ( menutitle == undefined ) {
60					menutitle = "Menu";
61				}
62				var $menulist = $(this).children('.rmm-main-list').html();
63				var $menucontrols ="<div class='rmm-toggled-controls'><div class='rmm-toggled-title'>" + menutitle + "</div><div class='rmm-button'><span>&nbsp;</span><span>&nbsp;</span><span>&nbsp;</span></div></div>";
64				$(this).prepend("<div class='rmm-toggled rmm-closed'>
64"+$menucontrols+"<ul>"+$menulist+"</ul></div>");
65
66		});
67}
68
69function adaptMenu() {
70	
71	/* 	toggle menu on resize */
72	
73	$('.rmm').each(function() {
74			var $width = $(this).css('max-width');
75			$width = $width.replace('px', ''); 
76			if ( $(this).parent().width() < $width*1.05 ) {
77				$(this).children('.rmm-main-list').hide(0);
78				$(this).children('.rmm-toggled').show(0);
79			}
80			else {
81				$(this).children('.rmm-main-list').show(0);
82				$(this).children('.rmm-toggled').hide(0);
83			}
84		});
85		
86}
87
88$(function() {
89
90	 responsiveMobileMenu();
91	 getMobileMenu();
92	 adaptMenu();
93	 
94	 /* slide down mobile menu on click */
95	 
96	 $('.rmm-toggled, .rmm-toggled .rmm-button').click(function(){
97	 	if ( $(this).is(".rmm-closed")) {
98		 	 $(this).find('ul').stop().show(300);
99		 	 $(this).removeClass("rmm-closed");
100	 	}
101	 	else {
102		 	$(this).find('ul').stop().hide(300);
103		 	 $(this).addClass("rmm-closed");
104	 	}
105		
106	});	
107
108});
109	/* 	hide mobile menu on resize */
110$(window).resize(function() {
111 	adaptMenu();
112});

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.