PageSourceSearch

https://sklep.mayday.pl/themes/mayday/modules/an_megamenu/views/js/front.js

js mayday.pl collected 2026-10-08 20:02:06 UTC 3,934 bytes, 114 lines download raw bytes

1/*js*/
2
3function right_position() {
4	$('#amegamenu .adropdown').each(function (index, element) {
5		var this_offset_right = 0,
6			container_offset_right = 0,
7			this_offset_left = 0,
8			container_offset_left = 0;
9		this_offset_right = Math.floor($(this).offset().left + $(this).outerWidth(true));
10		
11		container_offset_right = Math.floor($(".header-top > .container").offset().left + $(".header-top > .container").outerWidth())-15;
12		
13		this_offset_left = Math.floor($(this).offset().left);
14		container_offset_left = Math.floor($(".header-top > .container").offset().left)+15;
15
16		if (this_offset_left < container_offset_left ){
17			$(this).offset({left: container_offset_left});
18		}
19		if (this_offset_right > container_offset_right){
20			$(this).offset({left: (container_offset_right-$(this).outerWidth(true))});
21
22		}
23
24	});
25}
26function dropdown_scroll() {
27	let windowHeight = $(window).height();
28	$('#amegamenu .adropdown').each(function (index, element) {
29		let el_pos = $(this).offset().top - $(window).scrollTop(),
30			el_height = $(this).outerHeight(true);
31		if (el_height + el_pos + 15 > windowHeight) {
32			$(this).addClass('dropdown-scroll');
33			$(this).css('height', windowHeight - el_pos - 15 + 'px');
34		} else {
35			$(this).removeClass('dropdown-scroll');
36			$(this).css('height', 'auto');
37		}
38	});
39}
40$(document).ready(function () {
41	// open modal
42	btn = $('#menu-icon'),
43		modal = $('.amegamenu_mobile-cover, .amegamenu_mobile-modal, #mobile_top_menu_wrapper');
44	btn.off();
45	btn.on('click', function(event) {
46		$('html').addClass('amegamenu_mobile-open');
47		modal.fadeIn();
48	});
49
50	// close modal
51	$('.amegamenu_mobile-modal').click(function() {
52		var select = $('#mobile_top_menu_wrapper');
53		if ($(event.target).closest(select).length)
54			return;
55		modal.fadeOut(function () {
56			$('html').removeClass('amegamenu_mobile-open');
57
58			$('.menu-active').removeClass('menu-active').delay(300).queue(function(){
59				$('.mobile_item_wrapper.open').removeClass('open').dequeue();;
60			});
61			$('#mobile_top_menu_wrapper').attr('data-level', 0);
62		});
63	});
64	$('.megamenu_mobile-btn-close').on('click', function(event) {
65		modal.fadeOut(function () {
66			$('html').removeClass('amegamenu_mobile-open');
67			$('#mobile_top_menu_wrapper .open').removeClass('open');
68			$('#mobile_top_menu_wrapper .menu-active').removeClass('menu-active');
69			$('#mobile_top_menu_wrapper').attr('data-level', 0);
70		});
71	});
72
73
74	var timerId_0=false;
75	if($('#amegamenu').length >0){
76		right_position();
77
78		$(window).on('load resize scroll', function() {
79			clearTimeout(timerId_0);
80			timerId_0 = setTimeout(function () {
81				right_position();
82				dropdown_scroll();
83			},10);
84		});
85	}
86	// mobile
87	$(".arrow_down").on("click",function(){
88		$(this).css("display","none");
89		$(this).next().css("display","inline");
90		$(this).closest(".amenu-item").find(".adropdown-mobile").slideDown();
91	});
92	$(".arrow_up").on("click",function(){
93		$(this).css("display","none");
94		$(this).prev().css("display","inline");
95		$(this).closest(".amenu-item").find(".adropdown-mobile").slideUp();
96	});
97
98	$('.mobile-toggler, .amenu-nolink, .mobile_item_wrapper>span').on('click', function() {
99		$('#mobile_top_menu_wrapper').attr('data-level', +$('#mobile_top_menu_wrapper').attr('data-level') + 1);
100		$('.amegamenu_mobile-modal').animate({scrollTop: 0},100);
101		$(this).closest('.mobile_item_wrapper').addClass('open').delay(50).queue(function(){
102			$(this).closest('.mobile_item_wrapper').next('.adropdown-mobile').addClass('menu-active').dequeue();
103		});
104	});
105	$('.mobile_item_wrapper .amenu-nolink').on('click', function(e) {
106		e.preventDefault();
107	});
108	$('.megamenu_mobile-btn-back').on('click', function() {
109		$('.menu-active').removeClass('menu-active').delay(300).queue(function(){
110			$(this).prev('.mobile_item_wrapper.open').removeClass('open').dequeue();;
111		});
112		$('#mobile_top_menu_wrapper').attr('data-level', +$('#mobile_top_menu_wrapper').attr('data-level') - 1);
113	});
114});

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.