PageSourceSearch

https://www.ukatlondonclinic.com/wp-content/themes/bootx/assets/js/menu.js

js ukatlondonclinic.com collected 2026-09-30 14:17:41 UTC 7,792 bytes, 197 lines download raw bytes

1jQuery(document).ready(function () {
2	var lastTouchEndTime = 0;
3	// Check if the .mega_menu_top element exists
4	if (jQuery('.mega_menu_top').length > 0) {
5
6		// Remove the 'no-bg-img' element if it exists
7		var noBgImg = document.getElementById('no-bg-img');
8		if (noBgImg) {
9			noBgImg.remove();
10		}
11
12		// Get the base URL dynamically
13		var baseUrl = window.location.origin;
14		var processurl = '';
15
16		// Check the window width to determine which menu to load
17		if (jQuery(window).width() > 959) {
18			// processurl = baseUrl + '/wp-json/aroham_menu/menu/1';
19		} else {
20			processurl = baseUrl + '/wp-json/aroham_menu/menu/2';
21		}
22
23		// AJAX request to load the menu
24		if (processurl != '') {
25			jQuery.ajax({
26				url: processurl,
27				dataType: 'html',
28				contentType: false,
29				cache: true,
30				processData: false,
31				success: function (response) {
32					if (jQuery(window).width() > 959) {
33						jQuery("#desktop_mega_menu").show().html(response);
34					} else {
35						jQuery("#desktop_mega_menu").hide();
36						jQuery("#mobile_menu").html(response);
37					}
38				},
39				error: function (xhr, status, error) {
40					console.log("Error: " + error);
41				}
42			});
43		}
44	}
45
46	if (jQuery(window).width() < 959) {
47		if (jQuery('.mega_menu_top').length == 0) {
48			jQuery('#mobile_menu').append(jQuery('#menu-main-menu'));
49		}
50	}
51	var openMenu = 'left';
52	if (jQuery("#smenu").hasClass('right_menu')) {
53		openMenu = 'right';
54	}
55
56	if (jQuery(window).width() < 959 && jQuery(".shiftnav-toggle").length > 0) {
57		if (openMenu == 'left') {
58			jQuery("#smenu").animate({ left: "-305px" }, 0);
59			jQuery(".shiftnav-toggle").click(function () {
60				var smenuheight = jQuery(window).innerHeight();
61				jQuery(".pquoteNav").attr('style', 'height:' + smenuheight + 'px;display:block');
62				if (jQuery('#smenu').hasClass("active")) {
63					jQuery("#smenu").animate({ left: "-305px" }, 500);
64					jQuery(".shiftbody").animate({ left: 0 }, 500);
65					if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ left: 0 }, 500); }
66					if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ left: 0 }, 500); }
67					jQuery('#smenu').removeClass("active");
68					jQuery('.shiftbody').removeClass("overflow");
69				} else {
70					jQuery("#smenu").animate({ left: 0 }, 500);
71					jQuery(".shiftbody").animate({ left: "300px" }, 500);
72					if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ left: "300px" }, 500); }
73					if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ left: "300px" }, 500); }
74					jQuery('#smenu').addClass("active");
75					jQuery('.shiftbody').addClass("overflow");
76				}
77			});
78		} else {
79			jQuery("#smenu").animate({ right: "-305px" }, 0);
80			jQuery(".shiftnav-toggle").click(function () {
81				var smenuheight = jQuery(window).innerHeight();
82				jQuery(".pquoteNav").attr('style', 'height:' + smenuheight + 'px;display:block');
83				if (jQuery('#smenu').hasClass("active")) {
84					jQuery("#smenu").animate({ right: "-305px" }, 500);
85					jQuery(".shiftbody").animate({ right: 0 }, 500);
86					if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ right: 0 }, 500); }
87					if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ right: 0 }, 500); }
88					jQuery('#smenu').removeClass("active");
89					jQuery('.shiftbody').removeClass("overflow");
90				} else {
91					jQuery("#smenu").animate({ right: 0 }, 500);
92					jQuery(".shiftbody").animate({ right: "300px" }, 500);
93					if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ right: "300px" }, 500); }
94					if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ right: "300px" }, 500); }
95					jQuery('#smenu').addClass("active");
96					jQuery('.shiftbody').addClass("overflow");
97				}
98			});
99		}
100		jQuery(document).on('click touchend', '#smenu li.menu-item-has-children', function (e) {
101			if (e.type === 'touchend') {
102				lastTouchEndTime = Date.now();
103			} else if (Date.now() - lastTouchEndTime < 600) {
104				return;
105			}
106
107			// Only act when tap/click lands on the :after chevron (rightmost 70px of the li)
108			var touches = e.originalEvent && e.originalEvent.changedTouches;
109			var clientX = (e.type === 'touchend' && touches && touches.length)
110				? touches[0].clientX
111				: e.clientX;
112			var rect = this.getBoundingClientRect();
113			console.log('[smenu] type:', e.type, '| clientX:', clientX, '| rect.right:', rect.right, '| zone start:', rect.right - 70, '| in after zone:', clientX >
113= rect.right - 70);
114			if (clientX < rect.right - 70) {
115				console.log('[smenu] tap on link text — navigating');
116				return;
117			}
118			console.log('[smenu] tap on :after chevron — toggling submenu');
119
120			e.stopPropagation();
121			e.preventDefault();
122			jQuery('#smenu li').removeClass('openli');
123			jQuery(this).parents("li").first().addClass('openli');
124			jQuery('#smenu .menu-item-has-children').removeClass('expanded');
125			if (jQuery(this).parents("li.menu-item-has-children").length == 0) {
126				jQuery(this).find('ul.sub-menu:first').slideUp('slow');
127			} else {
128				jQuery(this).find('li.menu-item-has-children ul.sub-menu').slideUp('slow');
129			}
130			jQuery(this).toggleClass('expanded');
131			if (jQuery(this).find('ul.sub-menu').is(":visible")) {
132				jQuery(this).find('ul.sub-menu').slideUp('slow');
133				jQuery(this).removeClass('expanded');
134			} else {
135				jQuery(this).siblings('li').find('ul.sub-menu').slideUp('slow');
136				jQuery(this).find('ul.sub-menu:first ').slideDown('slow');
137			}
138		});
139
140		jQuery(document).on('click touchend', '#smenu, #smenu ul.sub-menu', function (e) {
141			if (e.type === 'touchend') {
142				lastTouchEndTime = Date.now();
143			} else if (Date.now() - lastTouchEndTime < 600) {
144				return;
145			}
146			e.stopPropagation();
147		});
148
149		jQuery(document).bind('touchend click', function (e) {
150			if (e.type === 'touchend') {
151				lastTouchEndTime = Date.now();
152			} else if (Date.now() - lastTouchEndTime < 600) {
153				return;
154			}
155			if (jQuery(e.target).closest('#smenu').length > 0) {
156				return;
157			}
158			if (jQuery(e.target).attr('class') != 'shiftnav-toggle' && jQuery(e.target).parent().attr('class') != 'shiftnav-toggle') {
159				if (openMenu == 'left') {
160					if (jQuery('#smenu').hasClass("active")) {
161						jQuery("#smenu").animate({ left: "-305px" }, 500);
162						jQuery(".shiftbody").animate({ left: 0 }, 500);
163						if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ left: 0 }, 500); }
164						if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ left: 0 }, 500); }
165						jQuery('#smenu').removeClass("active");
166						jQuery('.shiftbody').removeClass("overflow");
167					}
168				} else {
169					if (jQuery('#smenu').hasClass("active")) {
170						jQuery("#smenu").animate({ right: "-305px" }, 500);
171						jQuery(".shiftbody").animate({ right: 0 }, 500);
172						if (jQuery(".topheader").length > 0) { jQuery(".topheader").animate({ right: 0 }, 500); }
173						if (jQuery(".fixbarbot").length > 0) { jQuery(".fixbarbot").animate({ right: 0 }, 500); }
174						jQuery('#smenu').removeClass("active");
175						jQuery('.shiftbody').removeClass("overflow");
176					}
177				}
178			}
179		});
180	}
181
182	if (jQuery('#menu .mega_menu, #menu .mega_menu.with_img').length > 0) {
183		jQuery('#menu .mega_menu, #menu .mega_menu.with_img').hover(function () {
184			if (jQuery(this).hasClass('with_img')) {
185				jQuery(this).parents('.hleft-box').addClass("nav_pos");
186				jQuery('#menu .mega_menu.with_img > ul.sub-menu > li').removeClass("active");
187				jQuery('#menu .mega_menu.with_img > ul.sub-menu > li:first-child').addClass("active");
188			} else {
189				jQuery(this).parents('.hleft-box').removeClass("nav_pos");
190			}
191		});
192		jQuery('#menu .mega_menu.with_img > ul.sub-menu > li').hover(function () {
193			jQuery('#menu .mega_menu.with_img > ul.sub-menu > li').removeClass("active");
194			jQuery(this).addClass("active");
195		});
196	}
197});

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.