PageSourceSearch

https://www.epoojastore.in/catalog/view/javascript/so_megamenu/so_megamenu.js

js epoojastore.in collected 2026-10-02 14:13:35 UTC 9,517 bytes, 254 lines download raw bytes

1var active = false;
2var hover = false;
3$(document).ready(function() {
4	$("ul.megamenu li .sub-menu .content .hover-menu ul li").hover(function () {
5		$(this).children("ul").show();
6
7	},function () {
8		$(this).children("ul").hide();
9	});
10	
11	
12	var wd_width = $(window).width();
13	if(wd_width <= 991) {
14		$("ul.megamenu > li.hover").unbind('mouseenter mouseleave');
15		removeWidthSubmenu();	
16		clickMegaMenu();
17	} else {
18		$( "ul.megamenu > li.hover").unbind( "click" );
19		hoverMegaMenu();
20		renderWidthSubmenu();
21	}
22	
23	$(window).resize(function() {
24		var sp_width = $(window).width();
25		if(sp_width <= 991){
26			$("ul.megamenu > li.hover").unbind('mouseenter mouseleave');
27			removeWidthSubmenu();
28			clickMegaMenu();
29		}	
30		else{
31			$( "ul.megamenu > li.hover").unbind( "click" );
32			hoverMegaMenu();
33			renderWidthSubmenu();
34		}	
35	});
36	
37	
38	$("ul.megamenu > li.click").click(function () {
39		if($(this).find(".content").is(':visible')) { return false; }
40		active = $(this);
41		hover = true;
42		var transition = $(this).closest(".megamenu").data("transition");
43		var animation_time = $(this).closest(".megamenu").data("animationtime");		
44		$("ul.megamenu > li").removeClass("active");
45		$(this).addClass("active");
46		$("ul.megamenu > li").children(".sub-menu").hide();
47		$("ul.megamenu > li").find(".content").hide();
48		$(this).children(".sub-menu").show();
49		if(transition == 'slide') {
50			$(this).find(".content").show();
51			$(this).find(".content").css("height", "auto");
52			var originalHeight = $(this).find(".content").height();
53			$(this).find(".content").css("height", 0);
54			$(this).find(".content").stop(true, true).animate({ height:originalHeight },animation_time);
55		} else if(transition == 'fade') {
56			$(this).find(".content").fadeIn(animation_time);
57		} else {
58			$(this).find(".content").show();
59		}		
60		$(this).children(".sub-menu").css("right", "auto");
61			if ($("html").css("direction").toLowerCase() == "rtl"){
62				var $whatever        = $(this).children(".sub-menu");
63				var $whatever2       =  $($whatever).closest('ul.megamenu');
64				if($whatever.offset().left < $whatever2.offset().left) {
65					$(this).children(".sub-menu").css("right", "0");
66				}				
67			}else{
68				var $whatever        = $(this).children(".sub-menu");
69				var ending_right     = ($(window).width() - ($whatever.offset().left + $whatever.outerWidth()));
70				var $whatever2       =  $($whatever).closest('ul.megamenu');
71				var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
72				if(ending_right2 > ending_right) {
73					$(this).children(".sub-menu").css("right", "0");
74				}				
75			}
76
77		return false;
78	});
79	
80	$("#show-megamenu").click(function () {
81		if($('.megamenu-wrapper').hasClass('so-megamenu-active'))
82			$('.megamenu-wrapper').removeClass('so-megamenu-active');
83		else
84			$('.megamenu-wrapper').addClass('so-megamenu-active');
85	}); 
86	$('#remove-megamenu').click(function() {
87        $('.megamenu-wrapper').removeClass('so-megamenu-active');
88        return false;
89    });		
90	
91	$("#show-verticalmenu").click(function () {
92		if($('.vertical-wrapper').hasClass('so-vertical-active'))
93			$('.vertical-wrapper').removeClass('so-vertical-active');
94		else
95			$('.vertical-wrapper').addClass('so-vertical-active');
96	}); 
97	$('#remove-verticalmenu').click(function() {
98        $('.vertical-wrapper').removeClass('so-vertical-active');
99        return false;
100    });	
101	
102	$('html').on('click', function () {
103		$("ul.megamenu > li.click").removeClass("active");
104		$("ul.megamenu > li.click").children(".sub-menu").hide();
105		$("ul.megamenu > li.click").find(".content").hide();
106	});
107	$('.close-menu').on('click', function () {
108		$(this).parent().removeClass("active");
109		$(this).parent().children(".sub-menu").hide();
110		$(this).parent().find(".content").hide();
111		return false;
112	});
113});
114
115function renderWidthSubmenu()
116{
117	$('.vertical .sub-menu').each(function(){
118		value = $(this).data("subwidth");
119		if(value){
120			var container_width = $('.container').width();
121			var vertical_width = $('.vertical').width();
122			var full_width = container_width - vertical_width;
123			var width_submenu = (full_width*value)/100;
124			$(this).css('width',width_submenu+'px');
125		}	
126	});
127}	
128function removeWidthSubmenu()
129{
130	$('.vertical .sub-menu').each(function(){
131		$(this).css('width','100%');
132	});
133}
134function clickMegaMenu(){
135	$("ul.megamenu > li.hover").click(function () {
136		if($(this).find(".content").is(':visible')) { return true; }
137		active = $(this);
138		hover = true;
139		var transition = $(this).closest(".megamenu").data("transition");
140		var animation_time = $(this).closest(".megamenu").data("animationtime");
141		$("ul.megamenu > li").removeClass("active");
142		$(this).addClass("active");
143		$("ul.megamenu > li").children(".sub-menu").hide();
144		$("ul.megamenu > li").find(".content").hide();
145		$(this).children(".sub-menu").show();
146		if(transition == 'slide') {
147			$(this).find(".content").show();
148			$(this).find(".content").css("height", "auto");
149			var originalHeight = $(this).find(".content").height();
150			$(this).find(".content").css("height", 0);
151			$(this).find(".content").stop(true, true).animate({ height:originalHeight },animation_time);
152		} else if(transition == 'fade') {
153			$(this).find(".content").fadeIn(animation_time);
154		} else {
155			$(this).find(".content").show();
156		}		
157		$(this).children(".sub-menu").css("right", "auto");
158			if ($("html").css("direction").toLowerCase() == "rtl"){
159				var $whatever        = $(this).children(".sub-menu");
160				var $whatever2       =  $($whatever).closest('ul.megamenu');
161				if($whatever.offset().left < $whatever2.offset().left) {
162					$(this).children(".sub-menu").css("right", "0");
163				}				
164			}else{
165				var $whatever        = $(this).children(".sub-menu");
166				var ending_right     = ($(window).width() - ($whatever.offset().left + $whatever.outerWidth()));
167				var $whatever2       =  $($whatever).closest('ul.megamenu');
168				var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
169				if(ending_right2 > ending_right) {
170					$(this).children(".sub-menu").css("right", "0");
171				}				
172			}
173
174	});	
175}
176
177function hoverMegaMenu(){
178		$("ul.megamenu > li.hover").hover(function () {
179			active = $(this);
180			hover = true;
181			var transition = $(this).closest(".megamenu").data("transition");
182			var animation_time = $(this).closest(".megamenu").data("animationtime");
183			$("ul.megamenu > li").removeClass("active");
184			$(this).addClass("active");
185			$("ul.megamenu > li").children(".sub-menu").hide();
186			$("ul.megamenu > li").find(".content").hide();
187			$(this).children(".sub-menu").show();
188			if(transition == 'slide') {
189				$(this).find(".content").show();
190				$(this).find(".content").css("height", "auto");
191				var originalHeight = $(this).find(".content").height();
192				$(this).find(".content").css("height", 0);
193				$(this).find(".content").stop(true, true).animate({ height:originalHeight },animation_time);
194			} else if(transition == 'fade') {
195				$(this).find(".content").fadeIn(animation_time);
196			} else {
197				$(this).find(".content").show();
198			}	
199			$(this).children(".sub-menu").css("right", "auto");	
200			if ($("html").css("direction").toLowerCase() == "rtl"){
201				var $whatever        = $(this).children(".sub-menu");
202				var $whatever2       =  $($whatever).closest('ul.megamenu');
203				if($whatever.offset().left < $whatever2.offset().left) {
204					$(this).children(".sub-menu").css("right", "0");
205				}				
206			}else{
207				var $whatever        = $(this).children(".sub-menu");
208				var ending_right     = ($(window).width() - ($whatever.offset().left + $whatever.outerWidth()));
209				var $whatever2       =  $($whatever).closest('ul.megamenu');
210				var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
211				if(ending_right2 > ending_right) {
212					$(this).children(".sub-menu").css("right", "0");
213				}				
214			}
215
216		},function () {
217			var rel = $(this).attr("title");
218			hover = false;
219			var transition = $(this).closest(".megamenu").data("transition");
220			var animation_time = $(this).closest(".megamenu").data("animationtime");
221			if(rel == 'hover-intent') {
222				var hoverintent = $(this);
223				setTimeout(function (){
224					if(hover == false) {
225						if(transition == 'slide') {
226							$(hoverintent).find(".content").stop(true, true).animate({ height:"hide" },animation_time, function() { if(hover == false) { $(hoverintent).removeClass("active"); $(hoverintent).children(".sub-menu").hide(); } });
227						} else if(transition == 'fade') {
228							$(hoverintent).removeClass("active");
229							$(hoverintent).find(".content").fadeOut(animation_time, function() {
230								if(hover == false) { $(hoverintent).children(".sub-menu").hide(); }
231							});
232						} else {
233							$(hoverintent).removeClass("active");
234							$(hoverintent).children(".sub-menu").hide();
235							$(hoverintent).find(".content").hide();
236						}
237					}
238				}, 500);
239			} else {
240				if(transition == 'slide') {
241					$(this).find(".content").stop(true, true).animate({ height:"hide" },animation_time, function() { if(hover == false) { $(active).removeClass("active"); $(active).children(".sub-menu").hide(); } });
242				} else if(transition == 'fade') {
243					$(active).removeClass("active");
244					$(this).find(".content").fadeOut(animation_time, function() {
245						if(hover == false) { $(active).children(".sub-menu").hide(); }
246					});
247				} else {
248					$(this).removeClass("active");
249					$(this).children(".sub-menu").hide();
250					$(this).find(".content").hide();
251				}
252			}
253		});	
254}

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.