PageSourceSearch

https://hardanger.fhs.no/wp-content/themes/uncode/library/js/stickyElements.js?ver=76492613

js hardanger.fhs.no collected 2026-09-25 10:20:24 UTC 3,719 bytes, 128 lines download raw bytes

1(function($) {
2	"use strict";
3
4	UNCODE.stickyElements = function() {
5	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
6	if (!isMobile_wide ) {
7
8		var $pageHeader = $('#page-header'),
9			$headerRow = $('.vc_row', $pageHeader),
10			$headerSection = $headerRow.closest('section[data-parent]'),
11			startSticky = false;
12
13		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
14			$headerRow.removeClass('sticky-element');
15			$pageHeader.addClass('sticky-element');
16			startSticky = true;
17		}
18
19		var calculateOffset = function(el) {
20			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
21				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
22				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
23				elTop = window.pageYOffset + el.getBoundingClientRect().top;
24
25			sideOffset += UNCODE.bodyBorder;
26
27			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
28			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
29				if ($('.menu-shrink').length) {
30					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
31				} else {
32					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
33				}
34			}
35
36			return sideOffset;
37
38		},
39
40		initStickyElement = function($els) {
41			if ( $('body').hasClass('vc-safe-mode') ) {
42				return true;
43			}
44			if ( typeof $els === 'undefined' ) {
45				$els = $('.sticky-element');
46			}
47			$.each($els, function(index, element) {
48				if ($(element).closest('.tab-pane').length) {
49					var $paneParent = $(element).closest('.tab-pane');
50					if ( !$paneParent.hasClass('active') ) {
51						return true;
52					}
53				}
54				$(element).stick_in_parent({
55					sticky_class: 'is_stucked',
56					offset_top: calculateOffset(element),
57					bottoming: true,
58					inner_scrolling: SiteParameters.sticky_elements === 'on'
59				});
60			});
61		};
62
63		var oldW = UNCODE.wwidth,
64			oldH = UNCODE.wHeight;
65
66		requestTimeout(function() {
67			if ($('.sticky-element').length) {
68
69				if ($(window).width() > UNCODE.mediaQuery) {
70					initStickyElement();
71
72					if ( startSticky === true ) {
73						$('#page-header').trigger('sticky_kit:recalc');
74					}
75				}
76
77				$(window).on('resize lateral_resize', function(event) {
78					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
79						$(".sticky-element").trigger("sticky_kit:detach");
80						if ($(window).width() > UNCODE.mediaQuery) {
81							initStickyElement();
82						}
83						oldW = UNCODE.wwidth;
84						oldH = UNCODE.wHeight;
85					}
86				});
87			}
88		}, 1000);
89
90		if ($('.sticky-element').length) {
91			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
92				requestTimeout(function() {
93					$(document.body).trigger("sticky_kit:recalc");
94				}, 100);
95			});
96		}
97
98		var $panels = $('.panel-collapse');
99		if ( $panels.length ) {
100			$panels.each(function(){
101				var $panel = $(this);
102				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
103					$(document.body).trigger("sticky_kit:recalc");
104				});
105			});
106		}
107
108		$('.nav-tabs a').on('shown.bs.tab', function(e){
109			var $tabs = $(e.target).closest('.tab-container'),
110				$panel = $('.tab-pane.active', $tabs),
111				$els = $(e.target).nextAll(".sticky-element");
112
113			$els.trigger("sticky_kit:detach");
114			initStickyElement($els);
115		});
116
117		$(window).on('vc-safe-mode-on', function(){
118			$(".sticky-element").trigger("sticky_kit:detach");
119		});
120
121		$(window).on('vc-safe-mode-off', function(){
122			initStickyElement();
123		});
124	}
125};
126
127
128})(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.