PageSourceSearch

https://fixarindustrial.com.br/catalog/view/theme/fastor/js/megamenu.js

js fixarindustrial.com.br collected 2026-10-06 12:54:34 UTC 7,148 bytes, 189 lines download raw bytes

1var active = false;
2var hover = false;
3var rtl = $('html').hasClass('rtl');
4var megamenuresponsive = false;
5$(document).ready(function() {
6	if(responsive_design == 'yes' && $(window).width() < 992) {
7		megamenuresponsive = true;
8	}
9	
10	$("ul.megamenu > li").each(function () {
11		var i = 0;
12		$(this).find(".mobile-enabled").each(function () {
13			i++;
14		});
15				
16		if(i == 0) {
17			$(this).find(".open-menu").addClass("mobile-disabled");
18		}
19	});
20	
21	$("ul.megamenu li .sub-menu .content .hover-menu ul li").hover(function () {
22		$(this).children("ul").addClass("active");
23	},function () {
24		$(this).children("ul").removeClass("active");
25	});
26	
27	$('.close-categories').on('click', function () {
28		$(this).parent().removeClass("active");
29		$(this).next().animate({ height:"hide" },400);
30		return false;
31	});
32	
33	$('.open-categories').on('click', function () {
34		$(".open-categories").parent().removeClass("active");
35		$('.open-categories').next().next().animate({ height:"hide" },400);
36		
37		$(this).parent().addClass("active");
38		$(this).next().next().animate({ height:"show" },400);
39		return false;
40	});
41	
42	$('.close-menu').on('click', function () {
43		$(this).parent().removeClass("active");
44		$(this).next().next().next().animate({ height:"hide" },400);
45		return false;
46	});
47	
48	$('.open-menu').on('click', function () {
49		$("ul.megamenu > li").removeClass("active");
50		$("ul.megamenu > li").find(".sub-menu").animate({ height:"hide" },400);
51		
52		$(this).parent().addClass("active");
53		$(this).next().next().animate({ height:"show" },400);
54		megamenuresponsive = true;
55		return false;
56	});
57	
58	$("ul.megamenu > li.click .content a").click(function () {
59		window.location = $(this).attr('href');
60	});
61		
62	$("ul.megamenu > li.hover").hover(function () {
63		if(megamenuresponsive == false) {
64			active = $(this);
65			hover = true;
66			$("ul.megamenu > li").removeClass("active");
67			$(this).addClass("active");
68            if(!rtl){
69                $(this).children(".sub-menu").css("right", "auto");	
70                var $whatever        = $(this).children(".sub-menu");
71                var ending_right     = ($(window).width() - ($whatever.offset().left + $whatever.outerWidth()));
72                
73                if($('.header-type-3').length) {
74                	var $whatever2       = $("#top .container");
75                	var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
76                } else {
77                     var $whatever2       = $(".overflow-megamenu");
78                     var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
79                }
80                
81                if(ending_right2 > ending_right) {
82                	$(this).children(".sub-menu").css("right", "0");
83                }
84            }else{
85               $(this).children(".sub-menu").css("right", "auto");	
86               $(this).children(".sub-menu").css("left", "auto");	
87               var $whatever        = $(this).children(".sub-menu");
88               var ending_right     = $whatever.offset().left;
89               var $whatever2       = $(".horizontal ul.megamenu");
90               var ending_right2    = $whatever2.offset().left-45;
91               if(ending_right2 > ending_right) {
92                   $(this).children(".sub-menu").css("left", "0");
93               }
94            }
95            
96			var widthElement = $(this).children("a").outerWidth()/2;
97			var marginElement = $(this).children("a").offset().left-$(this).find(".content").offset().left;
98			$(this).find(".content > .arrow").css("left", marginElement+widthElement);
99		} 
100	},function () {
101		if(megamenuresponsive == false) {
102			var rel = $(this).attr("title");
103			hover = false;
104			if(rel == 'hover-intent') {
105				var hoverintent = $(this);
106				setTimeout(function (){
107					if(hover == false) {
108						$(hoverintent).removeClass("active");
109					}
110				}, 500);
111			} else {
112				$(this).removeClass("active");
113			}
114		}
115	});
116	
117	$("ul.megamenu > li.click").click(function () {
118		if($(this).removeClass("active") == true) { return false; }
119		active = $(this);
120		hover = true;
121		$("ul.megamenu > li").removeClass("active");
122		$(this).addClass("active");
123		if(megamenuresponsive == true) $(this).children(".sub-menu").animate({ height:"show" },400);
124        if(!rtl){
125            $(this).children(".sub-menu").css("right", "auto");	
126            var $whatever        = $(this).children(".sub-menu");
127            var ending_right     = ($(window).width() - ($whatever.offset().left + $whatever.outerWidth()));
128            
129            if($('.header-type-3').length) {
130            	var $whatever2       = $("#top .container");
131            	var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
132            } else {
133                 var $whatever2       = $(".overflow-megamenu");
134                 var ending_right2    = ($(window).width() - ($whatever2.offset().left + $whatever2.outerWidth()));
135            }
136            
137            if(ending_right2 > ending_right) {
138            	$(this).children(".sub-menu").css("right", "0");
139            }
140        }else{
141            $(this).children(".sub-menu").css("right", "auto");	
142            $(this).children(".sub-menu").css("left", "auto");	
143            var $whatever        = $(this).children(".sub-menu");
144            var ending_right     = $whatever.offset().left;
145            var $whatever2       = $(".horizontal ul.megamenu");
146            var ending_right2    = $whatever2.offset().left-45;
147            if(ending_right2 > ending_right) {
148                $(this).children(".sub-menu").css("left", "0");
149            } 
150        }
151            
152		var widthElement = $(this).children("a").outerWidth()/2;
153		var marginElement = $(this).children("a").offset().left-$(this).find(".content").offset().left;
154		$(this).find(".content > .arrow").css("left", marginElement+widthElement);
155		return false;
156	});
157	
158	$(".categories-image-right ul > li > a").hover(function () {
159	     $(this).closest('.categories-image-right').find('img').attr('src', $(this).attr('data-image'));
160	},function(){
161	     var src = $(this).closest('.categories-image-right').attr('data-image');
162	     $(this).closest('.categories-image-right').find('img').attr('src', src);
163	});
164	
165	$(".megaMenuToggle").click(function () {
166		if($(this).removeClass("active") == true) {
167			$(this).parent().find(".megamenu-wrapper").stop(true, true).animate({ height:"hide" },400);
168		} else {
169			$(this).parent().find(".megamenu-wrapper").stop(true, true).animate({ height:"toggle" },400);
170			$(this).addClass("active");
171		}
172		return false;
173	});
174	
175	$('html').on('click', function () {
176		if(!(responsive_design == 'yes' && $(window).width() < 992)) {
177			$("ul.megamenu > li.click").removeClass("active");
178		}
179	});
180});
181
182$(window).resize(function() {
183	megamenuresponsive = false;
184	
185	if(responsive_design == 'yes' && $(window).width() < 992) {
186		megamenuresponsive = true;
187	}
188});
189

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.