PageSourceSearch

https://www.elindo.fr/modules/avanamegamenu/views/js/front.js

js elindo.fr collected 2026-10-05 07:16:20 UTC 13,213 bytes, 356 lines download raw bytes

1/**
2* 2007-2015 PrestaShop
3*
4* NOTICE OF LICENSE
5*
6* This source file is subject to the Academic Free License (AFL 3.0)
7* that is bundled with this package in the file LICENSE.txt.
8* It is also avaiposle through the world-wide-web at this URL:
9* http://opensource.org/licenses/afl-3.0.php
10* If you did not receive a copy of the license and are unable to
11* obtain it through the world-wide-web, please send an email
12* to [email protected] so we can send you a copy immediately.
13*
14* DISCLAIMER
15*
16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17* versions in the future. If you wish to customize PrestaShop for your
18* needs please refer to http://www.prestashop.com for more information.
19*
20*  @author    PrestaShop SA <[email protected]>
21*  @copyright 2007-2015 PrestaShop SA
22*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23*  International Registered Trademark & Property of PrestaShop SA
24*
25* Don't forget to prefix your containers with your own identifier
26* to avoid any conflicts with others containers.
27*/
28
29$(document).ready(function()
30{	
31	mobileMenu();
32	activeMobile();
33	$(window).resize(function(){
34		if($(window).width() < 992)
35		{
36			$('.avaorg-menu-horizontal').addClass('avaorg-mobile-menu');
37			$('#_mobile_megamenu img').parent('a').addClass("img_banner"); 
38			$('.avaorg-mobile-menu').removeClass('container');	
39		}
40		else
41		{
42			$('.avaorg-menu-horizontal').removeClass('avaorg-mobile-menu');
43			$('.avaorg-menu-horizontal .menu-dropdown').show(); 		
44		}
45	});
46
47	initHorizontalMegamenu(); 
48
49	$('#_desktop_megamenu img').parent('a').addClass("img_desktop"); 
50	$('#_mobile_megamenu img').parent('a').addClass("img_banner"); 
51
52	// Menu Slider
53	//	var colId = $(this).data('colid');
54
55	var swiperMenu;
56    if (swiperMenu) {
57        swiperMenu.update(); // Update existing Swiper instance
58    } else {
59
60		// Loop through each .menu-swiper and initialize individually
61		$('#_desktop_megamenu .avaorg-menu-horizontal .menu-content .menu-swiper').each(function() {
62			//var $swiper = $(this);
63			var colId = $(this).data('colid');
64			
65			if ($('#_desktop_megamenu .avaorg-menu-horizontal .menu-content .menu-swiper[data-colid="' + colId + '"]').length) {
66				var cols = $('#_desktop_megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').data('cols');
67				var rows = $('#_desktop_megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').data('rows');
68				
69				var colgap = 30;
70				if($('#_desktop_megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').hasClass('product-list')) {
71					var colgap = 20;
72				}
73
74				var swiperMenu = new Swiper('#_desktop_megamenu .avaorg-menu-horizontal .menu-content .menu-swiper[data-colid="' + colId + '"]', {
75					direction: "horizontal",
76					spaceBetween: colgap,
77					slidesPerView: cols,
78					slidesPerColumn: rows,
79					slidesPerColumnFill: 'row',
80					speed: 0,
81					loop: false,
82					navigation: {
83						nextEl: '#_desktop_megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-button-next',
84						prevEl: '#_desktop_megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-button-prev',
85					},
86					pagination: {
87						el: '#_desktop_megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-pagination',
88						clickable: true,
89					},
90
91					breakpoints: {
92						1200: {
93						slidesPerView: cols, // show 4 above 1200
94							direction: "horizontal", // Change direction to horizontal above
95							spaceBetween: colgap,
96						},
97						992: {
98							slidesPerView: parseInt(cols - 1), // show 3 above 992
99							direction: "horizontal", // Change direction to horizontal from 992px above
100							spaceBetween: 20
101						},
102						768: {
103							slidesPerView: 2, // show 2 above 768 upto 992
104							direction: "horizontal", // Change direction to horizontal from 768px above
105							spaceBetween: 15
106						},
107						576: {
108							slidesPerView: 2, // show 2 above 576 upto 768
109							direction: "horizontal" // Change direction to horizontal from 768px above
110						},
111						320: {
112							slidesPerView: 2, // show 2 above 320 upto 576
113							direction: "horizontal" // Change direction to horizontal from 768px above
114						},
115						100: {
116							slidesPerView: 2, // show 2 above 100 upto 320
117							direction: "horizontal", // Change direction to horizontal from 768px above
118							spaceBetween: 10
119						}
120					},
121				});
122			}
123		});
124
125	}
126
127});
128function mobileMenu() {
129	$('#mobile-menu-icon') .click(function(){
130		$(this).toggleClass('open-menu'); 
131		var hClass = $(this).hasClass('open-menu');
132		if(hClass){
133			$(window).resize(function(){
134				if($(window).width() < 991)   
135				{
136					$(this).parents('body').css( 'overflow','hidden');
137				}
138			});
139			
140			$(this).parents('body') .find( '#mobile_menu_wrapper' ) .addClass('box-menu');
141		}
142		else
143		{
144			$(this).parents('body').css( 'overflow','visible');
145			$(this).parents('body') .find( '#mobile_menu_wrapper' ) .removeClass('box-menu');
146			
147		}
148	});	  
149	$('.menu-close') .click(function(){
150		$(this).parents('body').css( 'overflow','visible');
151		$(this).parents('body') .find( '#mobile_menu_wrapper' ) .removeClass('box-menu');
152		$(this).parents('body').find( '#mobile-menu-icon' ).removeClass('open-menu');
153	});	
154}
155function initHorizontalMegamenu() {
156    var $menuHorizontal = $('.avaorg-menu-horizontal');
157    var $list = $menuHorizontal.find('li.hasChild');
158
159    $list.hover(function() {
160        setOffset($(this))
161    });
162    var setOffset = function($li) {
163        var $dropdown = $li.find('.menu-dropdown');
164		if($dropdown.hasClass('cat-drop-menu')){
165			return;
166		}
167    	$dropdown.css({
168            'right': '',
169            'left': '',
170            //'width': $dropdown.data('width')
171        });
172        
173        var dropdownWidth = $dropdown.outerWidth();
174        var dropdownOffset = $dropdown.offset();
175        var toRight;
176        var viewportWidth;
177        var dropdownOffsetRight;
178        var $window = $(window);
179        var $body = $('body');
180        var screenWidth = $window.width();
181        if (!dropdownWidth || !dropdownOffset) {
182            return
183        }
184        if (dropdownWidth > screenWidth) {
185            dropdownWidth = screenWidth
186        }
187        $dropdown.css({
188            //'width': dropdownWidth
189        });
190        if ($li.hasClass('hasChild') && dropdownWidth > 1200) {
191            viewportWidth = $window.width();
192            if (dropdownOffset.left + dropdownWidth >= viewportWidth) { 
193				toRight = dropdownOffset.left + dropdownWidth - viewportWidth;
194				$dropdown.css({
195					left: -toRight
196				})
197			}
198            $li.addClass('menu_initialized')
199        } else if ($li.hasClass('dropdown-mega')) {
200    		viewportWidth = $('#header .elementor-container').innerWidth();
201            dropdownOffsetRight = viewportWidth - dropdownOffset.left - dropdownWidth;
202            var extraSpace = 0;
203            var containerOffset = ($window.width() - viewportWidth) / 2;
204            var dropdownOffsetLeft;
205            if (dropdownWidth >= viewportWidth) {
206                extraSpace = (viewportWidth - dropdownWidth) / 2
207            }
208            dropdownOffsetLeft = dropdownOffset.left - containerOffset;
209			if (dropdownOffsetLeft + dropdownWidth >= viewportWidth) {
210				toRight = dropdownOffsetLeft + dropdownWidth - viewportWidth;
211				$dropdown.css({
212					left: -toRight - extraSpace -10
213				})
214			}
215            
216            $li.addClass('menu_initialized')
217        } else {
218            $li.addClass('menu_initialized')
219        }
220    };
221    $list.each(function() {
222        setOffset($(this))
223    })
224}
225function activeMobile(){
226	$('.avaorg-menu-horizontal .menu-item > .icon-drop-mobile').on('click', function(){
227		if($(this).hasClass('open_menu')) {
228			$('.avaorg-menu-horizontal .menu-item > .icon-drop-mobile').removeClass( 'open_menu' );   
229			$(this).removeClass( 'open_menu' );  
230			$(this).next('.mobile-menu .avaorg-menu-horizontal .menu-dropdown').slide
230Up();
231			$('.avaorg-menu-horizontal .menu-item > .icon-drop-mobile').next('.mobile-menu .avaorg-menu-horizontal .menu-dropdown').slideUp();
232		}
233		else {	
234			$('.avaorg-menu-horizontal .menu-item > .icon-drop-mobile').removeClass( 'open_menu' ); 
235			$('.avaorg-menu-horizontal .menu-item > .icon-drop-mobile').next('.mobile-menu .avaorg-menu-horizontal .menu-dropdown').slideUp();
236			$(this).addClass( 'open_menu' );   
237			$(this).next('.mobile-menu .avaorg-menu-horizontal .menu-dropdown').slideDown(function () {
238                swiperInitMega();
239            });
240	
241		}
242		
243	});
244	$('.avaorg-menu-horizontal .cat-drop-menu .icon-drop-mobile').on('click', function(){
245		if($(this).hasClass('open_menu')) {
246			$(this).parent().siblings().find('.icon-drop-mobile').removeClass( 'open_menu' );   
247			$(this).removeClass( 'open_menu' );  
248			$(this).next('.avaorg-menu-horizontal .cat-drop-menu').slideUp();
249			$(this).parent().siblings().find('.cat-drop-menu').slideUp();
250		}
251		else {	
252			$(this).parent().siblings().find('.icon-drop-mobile').removeClass( 'open_menu' );  
253			$(this).parent().siblings().find('.cat-drop-menu').slideUp();
254			$(this).addClass( 'open_menu' );   
255			$(this).next('.avaorg-menu-horizontal .cat-drop-menu').slideDown(function () {
256                swiperInitMega();
257            });
258	
259		}
260		
261	});
262	$('.avaorg-menu-horizontal .avaorg-menu-col > .icon-drop-mobile').on('click', function(){
263		if($(this).hasClass('open_menu')) {
264			$('.avaorg-menu-horizontal .avaorg-menu-col > .icon-drop-mobile').removeClass( 'open_menu' );   
265			$(this).removeClass( 'open_menu' );  
266			$(this).next('.avaorg-menu-horizontal ul.ul-column').slideUp();
267			$('.avaorg-menu-horizontal .avaorg-menu-col > .icon-drop-mobile').next('.avaorg-menu-horizontal ul.ul-column').slideUp();
268		} 
269		else {	
270			$('.avaorg-menu-horizontal .avaorg-menu-col > .icon-drop-mobile').removeClass( 'open_menu' ); 
271			$('.avaorg-menu-horizontal .avaorg-menu-col > .icon-drop-mobile').next('.avaorg-menu-horizontal ul.ul-column').slideUp();
272			$(this).addClass( 'open_menu' );   
273			$(this).next('.avaorg-menu-horizontal ul.ul-column').slideDown();
274			$(this).next('.avaorg-menu-horizontal ul.ul-column').slideDown(function () {
275                swiperInitMega();
276            });
277
278	
279		}
280	
281	});
282	$('.avaorg-menu-horizontal .submenu-item  > .icon-drop-mobile').on('click', function(){
283		if($(this).hasClass('open_menu')) {
284			$('.avaorg-menu-horizontal .submenu-item  > .icon-drop-mobile').removeClass( 'open_menu' );   
285			$(this).removeClass( 'open_menu' );  
286			$(this).next('.avaorg-menu-horizontal ul.category-sub-menu').slideUp();
287			$('.avaorg-menu-horizontal .submenu-item  > .icon-drop-mobile').next('.avaorg-menu-horizontal ul.category-sub-menu').slideUp();
288		}
289		else {	
290			$('.avaorg-menu-horizontal .submenu-item  > .icon-drop-mobile').removeClass( 'open_menu' ); 
291			$('.avaorg-menu-horizontal .submenu-item  > .icon-drop-mobile').next('.avaorg-menu-horizontal ul.category-sub-menu').slideUp();
292			$(this).addClass( 'open_menu' );   
293			$(this).next('.avaorg-menu-horizontal ul.category-sub-menu').slideDown(function () {
294                swiperInitMega();
295            });
296	
297		}
298	});
299}
300
301
302function swiperInitMega() {
303	// Swiper initialization function
304	var swiperMenu;
305    if (swiperMenu) {
306        swiperMenu.update(); // Update existing Swiper instance
307    } else {
308		// Loop through each .menu-swiper and initialize individually
309		$('#mobile-megamenu .avaorg-menu-horizontal .menu-content .menu-swiper').each(function() {
310			//var $swiper = $(this);
311			var colId = $(this).data('colid');
312			
313			if ($('#mobile-megamenu .avaorg-menu-horizontal .menu-content .menu-swiper[data-colid="' + colId + '"]').length) {
314				var cols = $('#mobile-megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').data('cols');
315				var rows = $('#mobile-megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').data('rows');
316
317				if($('#mobile-megamenu .avaorg-menu-horizontal .menu-swiper[data-colid="' + colId + '"] .swiper-wrapper').hasClass('product-list')) {
318					var colsMobile = 1;
319				} 
320				else{
321					var colsMobile = 2;
322				}
323
324				var swiperMenu = new Swiper('#mobile-megamenu .avaorg-menu-horizontal .menu-content .menu-swiper[data-colid="' + colId + '"]', {
325					direction: "horizontal",
326					spaceBetween: 10,
327					slidesPerView: 2,
328					slidesPerColumn: rows,
329					slidesPerColumnFill: 'row',
330					speed: 0,
331					loop: false,
332					navigation: {
333						nextEl: '#mobile-megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-button-next',
334						prevEl: '#mobile-megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-button-prev',
335					},
336					pagination: {
337						el: '#mobile-megamenu .menu-swiper[data-colid="' + colId + '"] .swiper-pagination',
338						clickable: true,
339					},
340
341					breakpoints: {
342						320: {
343							slidesPerView: colsMobile, // show 2 above 320px upto 767
344							direction: "horizontal", // Change direction to horizontal from 991px above
345						},
346						100: {
347							slidesPerView: colsMobile, // show 1 above 100px upto 320
348							direction: "horizontal" // Change direction to horizontal from 319px above
349						}
350					},
351				});
352			}
353		});
354
355    }
356}

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.