PageSourceSearch

https://adeleadamsassociates.co.uk/wp-content/plugins/make-plus/js/stickyheader/frontend.js?ver=1.9.16

js adeleadamsassociates.co.uk collected 2026-10-07 23:59:59 UTC 2,037 bytes, 99 lines download raw bytes

1/**
2 * @package Make Plus
3 */
4
5/* global jQuery */
6
7(function($) {
8	'use strict';
9
10	var MakePlus = {
11		/**
12		 * Cache elements for later
13		 *
14		 * @since 1.7.0.
15		 */
16		cache: {
17			$window: $(window),
18			$document: $(document)
19		},
20
21		/**
22		 * Initialize the sticky header functionality.
23		 *
24		 * @since 1.7.0.
25		 */
26		initStickyHeader: function() {
27			var self = this,
28				$el;
29
30			self.cache.$stickyheader = $('.makeplus-sticky-header');
31
32			self.cache.$document.ready(function() {
33				if (self.cache.$stickyheader.length > 0) {
34					if (self.cache.$stickyheader.hasClass('sticky-header-bar')) {
35						$el = self.cache.$stickyheader.find('.header-bar');
36					} else if (self.cache.$stickyheader.hasClass('sticky-site-header')) {
37						$el = self.cache.$stickyheader;
38					}
39
40					self.makeSticky($el);
41					self.initAnchorOffset($el);
42				}
43			});
44		},
45
46		/**
47		 * Clone the element and add a class to apply sticky styles to it.
48		 *
49		 * @since 1.7.0.
50		 *
51		 * @param $el    A jQuery object
52		 */
53		makeSticky: function($el) {
54			$el.clone().attr('aria-hidden', true).insertAfter($el);
55			$el.addClass('makeplus-is-sticky');
56		},
57
58		/**
59		 * Calculate the height to offset and bind events.
60		 *
61		 * @since 1.7.3.
62		 *
63		 * @param $el    A jQuery object
64		 */
65		initAnchorOffset: function($el) {
66			var self = MakePlus,
67				$adminbar = $('#wpadminbar');
68
69			self.cache.headerheight = $el.innerHeight();
70			if ($adminbar.length > 0) {
71				self.cache.headerheight += $adminbar.innerHeight();
72			}
73
74			self.cache.$window.on('hashchange', self.anchorOffset);
75
76			self.anchorOffset();
77		},
78
79		/**
80		 * Offset the scroll position of the document to account for the sticky header.
81		 *
82		 * @since 1.7.3.
83		 */
84		anchorOffset: function() {
85			var self = MakePlus,
86				$target = $(':target'),
87				offset, posish;
88
89			if ($target.length > 0) {
90				offset = $(':target').offset();
91				posish = parseInt(offset.top) - self.cache.headerheight;
92
93				self.cache.$document.scrollTop(posish);
94			}
95		}
96	};
97
98	MakePlus.initStickyHeader();
99})(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.