PageSourceSearch

https://myfbr.ru/wp-content/themes/fbr_site/js/main.js?ver=7.1.2

js myfbr.ru collected 2026-10-05 06:42:17 UTC 3,931 bytes, 148 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function(){
2
3
4    // header top menu V2
5    const burgerButton = document.querySelector('.burger_button')
6    const menuToggle = document.querySelector('.menu_toggle')
7    const body = document.querySelector('body')
8    const menuLinks = document.querySelectorAll('.menu_toggle a')
9    const menuLi = document.querySelectorAll('.menu_toggle li')
10
11    burgerButton.addEventListener('click', function() {
12        menuToggle.classList.toggle('menuopen')
13        burgerButton.classList.toggle('open')
14        body.classList.toggle('stop-scrolling')
15    })
16
17    menuLinks.forEach(link => {
18        link.addEventListener('click', function() {
19            menuToggle.classList.remove('menuopen')
20            burgerButton.classList.remove('open')
21            body.classList.remove('stop-scrolling')
22        })
23    })
24
25
26    //  mainlogo animate
27    function handleMarquee(){
28	 	const marquee = document.querySelectorAll('.marquee');
29	 	let speed = 4;
30	 	let lastScrollPos = 0;
31	 	let timer;
32	 	
33	 	marquee.forEach(function(el){
34	 		const container = el.querySelector('.inner');
35	 		const content = el.querySelector('.inner > *');
36	 		//Get total width
37	 		const  elWidth = content.offsetWidth;
38	 		
39	 		let progress = 1;
40	 		function loop(){
41	 			progress = progress-speed;
42	 			if(progress <= elWidth*-1) {progress=0;}
43	 			container.style.transform = 'translateX(' + progress + 'px)';
44	 			
45	 			window.requestAnimationFrame(loop);
46	 		}
47	 		loop();
48	 	});
49	 	
50	 	window.addEventListener('scroll', function(){
51
52	 		var maxScrollValue = 15
53	 		const breakpoint = window.matchMedia( '(max-width: 991px)' );
54	 		if (breakpoint.matches === false) {
55    	        maxScrollValue = 15;
56    	    } else {
57    	        maxScrollValue = 8;
58
59    	    }
60	 		const newScrollPos = window.scrollY;
61	 		let scrollValue = newScrollPos - lastScrollPos;
62	 		
63	 		
64	 		if( scrollValue > maxScrollValue ) scrollValue = maxScrollValue;
65	     else if( scrollValue < -maxScrollValue ) scrollValue = -maxScrollValue;
66	 		
67	 		speed = scrollValue;
68	 		
69	 		clearTimeout(timer);
70	     timer = setTimeout(handleSpeedClear, 10);
71	 	});
72	 	
73	 	function handleSpeedClear(){
74	 		speed = 0;
75	 	}
76	 };
77	 
78	 handleMarquee();
79
80
81	// actual__slider
82	const actualSlider = new Swiper('.actual__slider', {
83		slidesPerView: 1.2,
84		loop: true,
85		speed: 500,
86		spaceBetween: 15,
87		observer: true,
88		observeParents: true,
89		autoplay: {
90			delay: 5000,
91		},
92	  	breakpoints: {
93	        576: {
94	        	slidesPerView: 1.2,
95	        	spaceBetween: 20,
96	        },
97	        768: {
98	        	slidesPerView: 1.2,
99	        	spaceBetween: 20,
100	        },
101	        991: {
102	        	slidesPerView: 2,
103	        	spaceBetween: 20,
104	        },
105	        1199: {
106	        	slidesPerView: 2,
107	        	spaceBetween: 20,
108	        },
109	    }
110	});
111
112
113	// SMOOTH SCROLL
114    if (window.location.pathname =='/') {
115
116        document.querySelectorAll('.sm-scroll a[href^="#"').forEach(link => {
117
118            link.addEventListener('click', function(e) {
119                e.preventDefault();
120        
121                let href = this.getAttribute('href').substring(1);
122                const scrollTarget = document.getElementById(href);
123                // const topOffset = document.querySelector('.sm-scroll').offsetHeight;
124                const topOffset = 0;
125                const elementPosition = scrollTarget.getBoundingClientRect().top;
126                const offsetPosition = elementPosition - topOffset;
127        
128                window.scrollBy({
129                    top: offsetPosition,
130                    behavior: 'smooth'
131                });
132            });
133        });
134
135    } else {
136
137        const menuLinks = document.querySelectorAll('.main__menu li:not(.home-page) a')
138        menuLinks.forEach( menuLink=> {
139            var oldLink = menuLink.getAttribute("href");
140            menuLink.setAttribute("href", '/' + oldLink);
141        })
142
143    }
144
145
146
147
148});

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.