PageSourceSearch

https://www.noejagdverband.at/wp-content/themes/jagdverband/assets…/bt-sticky-integration-script.js?ver=7.1.2

js noejagdverband.at collected 2026-10-02 16:58:08 UTC 8,150 bytes, 241 lines download raw bytes

1(function( $ ) {
2	$('document').ready(function(){
3		$('.mobile-noe-map a').on('click', function(){
4			if($('#off-canvas-right').hasClass('open')) {
5				$('#off-canvas-right').removeClass('open');
6			}
7		});
8		
9		$('#main-nav a.responsive-nav').on('click', function(){
10			if($('#off-canvas-bezirke').hasClass('open')) {
11				$('#off-canvas-bezirke').removeClass('open');
12			}
13		});
14		
15		$('body:not(.district-page) .nav-mobile #menu-hauptmenue-1 > li > a').click(function(e){
16			e.preventDefault();
17		});
18		
19		/**
20		 * Kalender Darstellung auf mobilen Geräten
21		 *
22		 * Calendar-outer-box in höhere Ebene verschieben
23		 */
24		// var isIE = window.navigator.msPointerEnabled;
25		var isIE = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;
26		var isFF = !!window.sidebar;
27		var screensize = window.innerWidth;
28		// console.log('Screensize:' + screensize);
29		if (isFF && isIE == false) {
30			// Nur FF + Edge ausschließen
31			screensize = ++screensize;
32			// console.log('FF Screensize:' + screensize);
33		}
34		if (isIE) {
35			// console.log('IE Screensize:' + screensize);
36		}
37		if (screensize < 770) {
38			if( $('#wrapper-content').length > 0 ) {
39				$('#sidebar #calendar-outer-box').prependTo('#wrapper-content');
40			}
41		} else {
42			if( $('#wrapper-content > #calendar-outer-box').length > 0 ) {
43				$('#wrapper-content > #calendar-outer-box').appendTo('.sidebar__inner');
44			}
45		}
46		
47		changething = function(screensize) {
48			if ( screensize < 770 ) {
49				if( $('#wrapper-content').length > 0 ) {
50					$('#sidebar #calendar-outer-box').prependTo('#wrapper-content');
51				}
52			} else {
53				if( $('#wrapper-content > #calendar-outer-box').length > 0 ) {
54					$('#wrapper-content > #calendar-outer-box').appendTo('.sidebar__inner');
55				}
56			}
57		}
58		
59		$( window ).resize(function() {
60			var screensize = window.innerWidth;
61			if (isFF && isIE == false) {
62				screensize = ++screensize;
63			}
64			changething(screensize);
65		});
66	
67		/* Sticky Header */
68		$(".header-site").sticky({topSpacing: 0, zIndex: 999});
69
70		/* Sticky Sidebar */
71		$('#sidebar').stickySidebar({
72			topSpacing: 145,
73			bottomSpacing: 0,
74			resizeSensor: true,
75			stickyClass: 'is-fixed',
76			containerSelector: '#wrapper-content', //'#wrapper-content', //'#main-content',
77			innerWrapperSelector: '.sidebar__inner'
78		});
79		
80		/* Menu click event */
81		$("#menu-hauptmenue-1 > li ").on('click', function(){
82			$(this).toggleClass('choosen');
83			$(this).children('.sub-menu').toggle();
84		});
85		
86		/* Helper variable for scrolling/clicking */
87		// var clickedFromMenu = false;
88		
89		/* Scrolling on click event (Sidebar and main nav) */
90		$('a[href*="#"]:not(a[href="#"])').on('click', function(){
91			// clickedFromMenu = true;
92			var pos = $.attr(this, 'href').indexOf("#");
93			$('html, body').animate({
94				scrollTop: $('#' + $.attr(this, 'href').substr(pos+1) ).offset().top - 180
95			}, 500);
96			// $(this).addClass('visible-click');
97			// clickedFromMenu = false;
98						
99			$('.responsive-nav button.l-menu').removeClass('active');
100			
101			return false;
102		});
103		
104		// if page gets reloaded or click in main nav on an anchor > smooth scroll
105		if (window.location.href.indexOf("#") > -1) {
106			var url = window.location.href;
107			// trim everything after # including hash
108			var anchor = url.substring(url.indexOf('#')); // (remove everything from first character till #)
109			$('html, body').animate({
110				scrollTop: $(anchor).offset().top - 180
111			}, 500);
112		}
113		
114		/**
115		 * Makierung der Sidebar Links beim Scrollen 
116		 * + Fix für Edge > is-sticky wird nicht entfernt
117		 */
118		$(window).scroll(function () {
119			var content_scroll_top = parseInt($('html').scrollTop()+$('.header-site').height());
120			/*if(!$('#sticky-wrapper').hasClass('is-sticky')) {
121				$('.wrapper-content').css({'padding-top':content_scroll_top+"px"});
122			}*/
123			var offset_header = $('.wrapper-content').offset();
124			//console.info(offset_header.top+$('.wrapper-content').css('padding-top'));
125			//$('.header-block').css({'height':parseInt(offset_header.top - $(window).scrollTop())+'px'});
126			
127			
128			
129			// if(clickedFromMenu === false) {
130				$('.paragraph-title').each(function () {
131					var id = $(this).attr('id');
132					var sidebar_menu_item = $('#sidebar-menu > a[href="#'+id+'"]');
133					if(isScrolledIntoView($(this))){
134						// sidebar_menu_item.addClass('visible');
135						// if (sidebar_menu_item.hasClass('visible-click')) {
136							// sidebar_menu_item.removeClass('visible-click');
137							// return false;
138						// } else {
139							// $(this).siblings().removeClass('visible'); // if more then one elements visible, only mark last visible element
140							//$('#sidebar-menu > a').removeClass('visible'); // if more then one elements visible, only mark last visible element
141							//sidebar_menu_item.addClass('visible');
142						// }
143							
144					} else {
145						//sidebar_menu_item.removeClass('visible');
146					}
147				});
148			//} //clickedFromMenu = false;
149			
150			// Edge Fix
151			var isEdge = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style && !window.navigator.msPointerEnabled;
152			if (isEdge || isIE) {
153				var scrollTop = $(this).scrollTop();
154				if (scrollTop <= 0) {
155					// alert('top reached');
156					$('#sticky-wrapper').removeClass('is-sticky');
157				} else {
158					$('#sticky-wrapper').addClass('is-sticky');
159				}
160			}
161		});
162		
163		/* show / hide calendar for mobile devices 
164		 * marked calender icon 
165		 */
166		$('.button.fa-calendar-check-o').on('click', function() {
167			$('#calendar-outer-box').toggleClass('visible');
168			// mark calender icon as active
169			$(this).toggleClass('active');
170		});
171		
172		/* marked mobile nav icon */
173		$('.responsive-nav button.l-menu').on('click', function() {
174			// mark movile nav icon as active
175			$(this).toggleClass('active');
176		});
177		
178		// unmark mobile nav if click event is anywhere else (except on l-menu button or in off-canvas-right box)
179		$('#sticky-wrapper').on('click', function(event) {
180			var target = $ (event.target);
181			if ( !target.hasClass('l-menu') && !(target.parents('#off-canvas-right').length || event.target.id == 'off-canvas-right' ) ) {
182				$('.responsive-nav button.l-menu').removeClass('active');
183			}
184		});
185
186		/* page load / call with hash */
187		var hash = window.location.hash;
188		var header_height = 150;
189		if (screensize < 769) { 
190			var header_height = 80;
191		}
192		if(hash.indexOf("#") > -1) {
193			if ($(hash).length) {
194				var scrollPosition = $(hash).offset().top;
195				var anchorPosition = Math.round(scrollPosition)-header_height;
196				window.scrollTo(0,anchorPosition);
197			}
198		}
199
200		/* Hack for mobile nav on district-info-page to close the manu */
201		$("#menu-hauptmenue-bezirk-mobile a[href*='#']").on("click",function(){
202			$('#off-canvas-right').removeClass('open');
203		});
204	});
205	
206	function isScrolledIntoView(elem){
207		var $elem = $(elem);
208		var $window = $(window);
209
210		var docViewTop = $window.scrollTop();
211		var docViewBottom = docViewTop + $window.height();
212
213		var elemTop = $elem.offset().top + 50;
214		var elemBottom = elemTop + $elem.height() + 50;
215
216		return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
217	}
218})( jQuery );
219
220// When the user scrolls down, show the scrollTopBtn
221window.onscroll = function() {scrollFunction()};
222
223function scrollFunction() {
224  var scrollTopBtn =  document.getElementById('scrollTopBtn');
225  if (typeof(scrollTopBtn) != 'undefined' && scrollTopBtn != null) {
226    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
227      document.getElementById("scrollTopBtn").style.display = "inline-block";
228    } else {
229      document.getElementById("scrollTopBtn").style.display = "none";
230    }
231  }
232}
233
234// When the user clicks the button, scroll to the top of the site
235function topFunction() {
236  // document.body.scrollTop = 0;
237  // document.documentElement.scrollTop = 0;
238  jQuery("html, body").animate({
239    scrollTop: 0
240  }, 600);
241}

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.