PageSourceSearch

https://krist-vlg.ru/wp-content/themes/woodmart/js/scripts/menu/onePageMenu.js?ver=6.2.4

js krist-vlg.ru collected 2026-10-08 14:50:58 UTC 2,292 bytes, 93 lines download raw bytes

1/* global woodmart_settings */
2(function($) {
3	woodmartThemeModule.onePageMenu = function() {
4		var scrollToRow = function(hash) {
5			var $htmlBody = $('html, body');
6			var row = $('#' + hash + ', .wd-menu-anchor[data-id="' + hash + '"]');
7
8			$htmlBody.stop(true);
9
10			if (row.length < 1) {
11				return;
12			}
13
14			var position = row.offset().top;
15
16			$htmlBody.animate({
17				scrollTop: position - woodmart_settings.one_page_menu_offset
18			}, 800);
19
20			setTimeout(function() {
21				activeMenuItem(hash);
22			}, 800);
23		};
24
25		var activeMenuItem = function(hash) {
26			var itemHash;
27
28			$('.onepage-link').each(function() {
29				var $this = $(this);
30				itemHash = $this.find('> a').attr('href').split('#')[1];
31
32				if (itemHash === hash) {
33					$this.siblings().removeClass('current-menu-item');
34					$this.addClass('current-menu-item');
35				}
36			});
37		};
38
39		woodmartThemeModule.$body.on('click', '.onepage-link > a', function(e) {
40			var $this = $(this),
41			    hash  = $this.attr('href').split('#')[1];
42
43			if ($('#' + hash).length < 1 && $('.wd-menu-anchor[data-id="' + hash + '"]').length < 1) {
44				return;
45			}
46
47			e.stopPropagation();
48			e.preventDefault();
49
50			scrollToRow(hash);
51
52			// close mobile menu
53			$('.wd-close-side').trigger('click');
54			$('.wd-fs-close').trigger('click');
55		});
56
57		woodmartThemeModule.$window.scroll(function () {
58			var scroll = woodmartThemeModule.$window.scrollTop();
59			var $firstLint = $('.onepage-link:first');
60			if ( scroll < 50 && $firstLint.length ) {
61				activeMenuItem($firstLint.find('> a').attr('href').split('#')[1]);
62			}
63		});
64
65		if ($('.onepage-link').length > 0) {
66			$('.entry-content > .vc_section, .entry-content > .vc_row').waypoint(function() {
67				var $this = $($(this)[0].element);
68				var hash = $this.attr('id');
69				activeMenuItem(hash);
70			}, {offset: 150});
71
72			$('.wd-menu-anchor').waypoint(function() {
73				activeMenuItem($($(this)[0].element).data('id'));
74			}, {
75				offset: function() {
76					return $($(this)[0].element).data('offset');
77				}
78			});
79
80			var locationHash = window.location.hash.split('#')[1];
81
82			if (window.location.hash.length > 1) {
83				setTimeout(function() {
84					scrollToRow(locationHash);
85				}, 500);
86			}
87		}
88	};
89
90	$(document).ready(function() {
91		woodmartThemeModule.onePageMenu();
92	});
93})(jQuery);

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.