PageSourceSearch

https://www.advicoachbusinesscoaching.com/wp-content/themes/advicoach-subsite/js/functions.js?ver=1769806327

js advicoachbusinesscoaching.com collected 2026-10-07 17:41:00 UTC 8,380 bytes, 355 lines download raw bytes

1;(function($, window, document, undefined) {
2	var $win = $(window);
3	var $doc = $(document);
4	var $body = $(document.body);
5	var didScroll;
6	var lastScrollTop = 0;
7	var delta = 5;
8	var navbarHeight = $('.nav ul li.current-menu-ancestor ul').outerHeight();
9
10	var isMobile = {
11	   Android: function() {
12		   return navigator.userAgent.match(/Android/i);
13	   },
14	   BlackBerry: function() {
15		   return navigator.userAgent.match(/BlackBerry/i);
16	   },
17	   iOS: function() {
18		   return navigator.userAgent.match(/iPhone|iPad|iPod/i);
19	   },
20	   Opera: function() {
21		   return navigator.userAgent.match(/Opera Mini/i);
22	   },
23	   Windows: function() {
24		   return navigator.userAgent.match(/IEMobile/i);
25	   },
26	   any: function() {
27		   return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
28	   }
29	};
30
31	$doc.ready(function() {
32		$body = $('body');
33		var	scrollAmountOffset = 0;
34		// Accordions
35		accordionExpand('.accordion-head');
36
37		// Top Section padding fix
38		if ( !$('.nav ul li.current-menu-ancestor ul').length ) { // If there is no active submenu, then reduce the top padding.
39			$('.header+section.section-heading').css({
40				'padding-top' : '80px'
41			});
42		}
43
44		tabsTestimonials();
45
46		// Home page - Apply Form
47		$('.form-apply form').on( 'submit', function(){
48
49			var valid_form = true;
50			var required_fields = $(this).find('.required');
51			required_fields.removeClass( 'error' );
52			required_fields.each( function(){
53
54				if ( $(this).val() === '' ) {
55					$(this).addClass( 'error' );
56					valid_form = false;
57				}
58
59			});
60
61			if ( !valid_form ) {
62				return false;
63			}
64
65		});
66
67		// Magnific Video
68		$('.video-trigger').magnificPopup({
69			type: 'iframe',
70			closeBtnInside:true,
71			removalDelay: 300,
72  			mainClass: 'mfp-fade',
73  			closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>'
74		})
75
76		// Magnific Subscribe
77		$('.popup-trigger').magnificPopup({
78			type: 'inline',
79			closeBtnInside:true,
80			removalDelay: 300,
81  			mainClass: 'mfp-popup mfp-fade',
82  			closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>'
83		})
84
85		// navigation
86		$('.nav-trigger').on('click', function(e){
87			e.preventDefault();
88
89			$(this).toggleClass('active');
90
91			$body.toggleClass('has-menu-opened')
92		});
93
94		if ($('.list-testimonials').length) {
95			if ($('.list-testimonials li').length <= 4) {
96				$('.list-testimonials').addClass('has-less-items');
97			}
98		}
99
100		// Mobile Navigation
101		$('.nav li.menu-item-has-children > a').on('click', function(e){
102			if (isMobile.any() && $win.width() >= 1024) {
103				if (!$(this).parent().hasClass('js-show')) {
104					e.preventDefault();
105					$(this)
106						.parent()
107							.addClass('js-show')
108						.siblings()
109							.removeClass('js-show');
110				};
111			};
112
113			if ( $(window).width() < 1024 ) {
114
115				if (!$(this).parent().hasClass('js-show')) {
116					e.preventDefault();
117
118					$(this)
119						.next()
120						.slideDown()
121						.parent()
122						.addClass('js-show')
123						.siblings()
124						.removeClass('js-show')
125						.find('ul')
126						.slideUp();
127				}else{
128					$(this)
129						.parent()
130						.siblings()
131						.find('ul')
132						.slideUp()
133						.end()
134						.addClass('show');
135				}
136
137			}
138
139		});
140
141		// scroll button
142		$('.btn-scroll').on('click', function(e){
143			e.preventDefault()
144
145			var offsetSection = 0
146			var headerHeight = $('.header').outerHeight();
147			var seactionNext = $(this).closest('section').next('section')
148
149			if ( seactionNext.find('.section-container').length ) {
150				offsetSection = parseInt( seactionNext.find('.section-container').css('top'), 10 );
151			}
152
153			var	scrollAmount = seactionNext.offset().top - headerHeight + offsetSection
154
155			$('body, html').animate({
156				scrollTop: scrollAmount
157			}, 1000)
158		});
159
160	});
161
162	$win.load(function(){
163
164		// Slider Intro
165		if ($('.slider-intro .slide').length > 1) {
166			var options = {
167				autoplay:true,
168				items: 1,
169				loop:true,
170				dots:false,
171				nav:true,
172				touchDrag:true,
173				mouseDrag:true,
174				navText: ['back','next']
175			}
176
177			initSlider($('.slider-intro'), options);
178		}
179
180		// Slider Videos
181		if ($('.slider-videos .slide').length >= 1) {
182			var options = {
183				autoplay:false,
184				items: 1,
185				loop:true,
186				dots:true,
187				nav:false,
188				touchDrag:true,
189				mouseDrag:true,
190				video:true
191			}
192
193			initSlider($('.slider-videos'), options);
194		}
195
196		// Slider Videos
197		if ($('.slider-logos .slide').length > 4) {
198			var options = {
199				autoplay:false,
200				loop:true,
201				dots:false,
202				nav:true,
203				navText: ['',''],
204				touchDrag:false,
205				mouseDrag:false,
206				responsive : {
207				    0 : {
208				        items: 1
209				    },
210				    480 : {
211				        items: 2
212				    },
213				    768 : {
214				        items: 3
215				    },
216				    1200 : {
217				        items: 4
218				    }
219				}
220			}
221
222			initSlider($('.slider-logos'), options);
223		}
224		var regex = /#.+$/;
225		var href = window.location.href;
226		if (regex.test(href)) {
227			var anchor = window.location.hash.slice(1);
228
229			if ($('li').data('id', anchor).length) {
230				$('html, body').animate({scrollTop : $('li[data-id="' + anchor + '"]').offset().top - 120}, 'slow');
231			};
232		};
233
234		equalizeBoxHeight();
235	});
236
237	$win.on('scroll', function(){
238		if ($win.width() > 1200) {
239			fixedHeader();
240		};
241		if ($win.width() > 1023) {
242			didScroll = true;
243			setInterval(function() {
244			    if (didScroll) {
245			        hasScrolled();
246			        didScroll = false;
247			    }
248			}, 250);
249		};
250	});
251
252	$win.on('resize', function(){
253		$body.removeClass('has-fixed-header');
254		equalizeBoxHeight();
255	});
256
257	function hasScrolled() {
258	    var st = $(this).scrollTop();
259
260	    // Make sure they scroll more than delta
261	    if(Math.abs(lastScrollTop - st) <= delta)
262	        return;
263
264	    // If they scrolled down and are past the navbar, add class .nav-up.
265	    // This is necessary so you never see what is "behind" the navbar.
266
267	    //djhiii - this condition never fires; change to st > 100 to always fire on scroll
268	    // if (st > lastScrollTop && st > navbarHeight){
269	    if (st > 100){
270	        // Scroll Down
271	        $('.nav ul li.current-menu-ancestor ul').removeClass('nav-down').addClass('nav-up');
272	    } else {
273	        // Scroll Up
274	        if(st + $(window).height() < $(document).height()) {
275	            $('.nav ul li.current-menu-ancestor ul').removeClass('nav-up').addClass('nav-down');
276	        }
277	    }
278
279	    lastScrollTop = st;
280	}
281
282	function fixedHeader () {
283		winT = $win.scrollTop();
284		// if ( winT > 0) {
285        if ( winT > 0 && $('.header .nav').length ) {
286			$body.addClass('has-fixed-header');
287		} else {
288			$body.removeClass('has-fixed-header')
289		}
290	}
291
292	function initSlider($slider, options) {
293		var $slidesContainer = $slider.find('.slides');
294
295
296		$slidesContainer
297			.addClass('owl-carousel')
298			.owlCarousel(options);
299
300	}
301
302	function tabsTestimonials (argument) {
303		var activeTabClass = 'current';
304
305		$('.tabs .tabs-nav a').on('click', function(event) {
306			var $tabLink = $(this);
307			var $targetTab = $($tabLink.attr('href'));
308
309			$tabLink
310				.parent() // go up to the <li> element
311				.add($targetTab)
312				.addClass(activeTabClass)
313					.siblings()
314					.removeClass(activeTabClass);
315
316			event.preventDefault();
317		});
318	}
319
320	function accordionExpand (accordionHeadSelector) {
321		var activeAccordionClass = 'expanded';
322
323		$(accordionHeadSelector).on('click', function() {
324			if ($(this).parent().hasClass(activeAccordionClass)) {
325				$(this).next().slideUp().parent().removeClass(activeAccordionClass);
326			}else {
327				$(this)
328				$(this)
329				.next()
330				.slideToggle()
331				.parent()
332				.addClass(activeAccordionClass)
333					.siblings()
334					.removeClass(activeAccordionClass)
335					.children('.accordion-body')
336					.slideUp();
337			}
338		});
339	}
340
341	function equalizeBoxHeight() {
342		var $blocks = $('.section-blocks-alt ul');
343
344		$blocks.each(function(){
345			var height = $(this).height();
346
347			if ( $win.width() > 747) {
348				$(this).find('li').innerHeight(height);
349			} else {
350				$(this).find('li').innerHeight('auto');
351			}
352		});
353	}
354
355})(jQuery, window, document);

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.