PageSourceSearch

https://monolithmarketing.com/wp-content/themes/archy-wp/js/main.js

js monolithmarketing.com collected 2026-10-06 18:09:50 UTC 51,156 bytes, 1,601 lines download raw bytes

1/*
2	Name: Pixelwars Blog Framework
3	Description: Shape-Shifter WordPress Theme Framework
4	Version: 2.0
5	Author: pixelwars
6*/
7
8(function ($) {
9	"use strict";
10
11	/* global variables */
12	var $masonry_container;
13	var isSafari = (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1 && navigator.userAgent.indexOf('Android') === -1);
14	var isIE = document.documentMode;
15	var isEdge = /Edge/.test(navigator.userAgent);
16
17
18	// DOCUMENT READY
19	$(function () {
20
21		// DETECT JUNK BROWSERS #$½#£#
22		if (isIE || isEdge) {
23			$('html').addClass('is-MS');
24		}
25		if (isIE) {
26			$('html').addClass('is-IE');
27		}
28		if (isEdge) {
29			$('html').addClass('is-Edge');
30		}
31
32		// BUTTONS : add classes to default buttons
33		$("form input[type=submit], form input[type=button], form button:not(.tutor-btn):not(.tutor-button)").addClass(("is-ready button is-primary " + $('html').data('generic-button-style')));
34
35
36		// FIX SIDEBAR INSTAGRAM
37		$('.sidebar .instagram-pics, .featured-area .instagram-pics').wrap('<div class="instagram-pics-wrap"></div>');
38		$('.sidebar .null-instagram-feed > p').appendTo($('.sidebar .instagram-pics-wrap'));
39		$('.featured-area .instagram-pics-wrap + p').appendTo($('.featured-area .instagram-pics-wrap'));
40
41		// FORMS
42		$('input:not([type=submit]):not([type=button]):not([type=file]):not([type=radio]):not([type=checkbox])').addClass('input-text');
43
44
45
46		// ------------------------------
47		// STICKY MENU
48
49		
50		if (!$('html').hasClass('is-menu-sticky')) {
51			$('.site-header').addClass('original');
52		}
53
54
55		// HEADER SMALL AND LOGO CENTER
56		if ($('html').hasClass('is-header-logo-center')) {
57			var total = parseInt($('.site-header .nav-menu > ul > li').length / 2);
58			$("<li></li>").addClass('menu-logo').insertAfter('.site-header .nav-menu > ul > li:nth-child(' + total + ')');
59			$('.site-header .site-branding').clone().appendTo($('.site-header .menu-logo'));
60			$('.site-header').addClass('ready');
61		}
62
63
64		// STICKY
65		if ($('html').hasClass('is-menu-sticky')) {
66
67			// the element to be sticky
68			var theElement = $('html').hasClass('is-menu-bar') ? $('.site-navigation') : $('.site-header');
69			var theElement = $('html').hasClass('is-logo-stick-with-menu') ? $('.site-header') : theElement;
70
71			// variables
72			var smart,
73				$orgElement,
74				$clonedElement,
75				orgElementTop,
76				currentScroll,
77				previousScroll = 0,
78				scrollDifference,
79				detachPoint = 650, // point of detach (after scroll passed it, menu is fixed)
80				hideShowOffset = 6, // scrolling value after which triggers hide/show menu
81				$html = $('html');
82
83
84			// Create a clone of the menu, right next to original.
85			theElement.addClass('original').clone().insertAfter(theElement).addClass('clone').removeClass('original');
86
87			$orgElement = $('.original');
88			$clonedElement = $('.clone');
89
90			/* if ($('html').hasClass('is-logo-stick-with-menu') && $('html').hasClass('is-menu-bar')) {
91				$clonedElement.find('.site-navigation').addClass('clone');
92			} */
93
94
95			smart = $('html').hasClass('is-menu-smart-sticky');
96
97			// fix css max-width issue for the fixed positioned clone element
98			//$clonedElement.width($orgElement.width());
99			/* $(window).on("resize", function () {
100				$clonedElement.width($orgElement.width());
101			}); */
102			if (smart) {
103				$html.addClass('menu-invisible');
104			}
105			$(window).on("scroll", function () {
106
107				// don't run if mobile menu is toggled on
108				if($html.hasClass('is-menu-toggled-on')) return;
109
110				currentScroll = $(this).scrollTop(), // gets current scroll position
111					scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
112
113				// fix css max-width issue for the fixed positioned clone element
114				//$clonedElement.width($orgElement.width());
115
116				//if (window.matchMedia("(min-width: 992px)").matches) {
117
118				orgElementTop = $orgElement.offset().top;
119
120				// Scrolled past the original position; now only show the cloned, sticky element.
121				if (currentScroll >= (orgElementTop) && currentScroll != 0) {
122
123
124					// if : SMART STICKY 
125					if (smart) {
126
127						// if scrolled past detach point add class to fix menu
128						if (currentScroll > detachPoint) {
129							if (!$html.hasClass('menu-detached')) {
130								$html.addClass('menu-detached');
131							}
132
133							// if scrolling faster than hideShowOffset hide/show menu
134							if (scrollDifference >= hideShowOffset) {
135								// scrolling down; hide menu  
136								if (currentScroll > previousScroll) {
137									if (!$html.hasClass('menu-invisible')) {
138										$html.addClass('menu-invisible');
139									}
140								}
141								// scrolling up; show menu
142								else {
143									if ($html.hasClass('menu-invisible')) {
144										$html.removeClass('menu-invisible');
145									}
146								}
147							}
148
149						} else {
150							if (!$html.hasClass('menu-invisible') && $('html').hasClass('is-header-float')) {
151								$html.addClass('menu-invisible');
152							}
153						}
154					} // if : smart
155
156
157					// else : NORMAL STICKY
158					else {
159						$clonedElement.addClass('is-visible');
160						$orgElement.addClass('is-hidden');
161						$html.addClass('is-sticky-menu-visible');
162					}
163
164				}
165				// Scrolled past the original position; now only show the cloned, sticky element.
166
167
168				// NOT scrolled past the menu; only show the original menu.
169				else {
170
171					if (smart) {
172
173						$html.addClass('menu-invisible').removeClass('menu-detached');
174						if ($('html').hasClass('is-header-float')) {
175
176						} else {
177
178						}
179
180					} else { // NORMAL STICKY
181						$clonedElement.removeClass('is-visible');
182						$orgElement.removeClass('is-hidden');
183						$html.removeClass('is-sticky-menu-visible');
184					}
185				}
186				// NOT scrolled past the menu; only show the original menu.
187
188
189				// replace previous scroll position with new one
190				previousScroll = currentScroll;
191
192
193
194				//} // > 991
195
196			}); // window on scroll
197
198		} // STICKY MENU 
199		// ------------------------------	
200
201		// ------------------------------
202		// STICKY: Header Smaller after scrolled down
203		window.addEventListener('scroll', function () {
204			var distanceY = window.pageYOffset || document.documentElement.scrollTop,
205				shrinkOn = 300,
206				$html = $('html');
207			if (distanceY > shrinkOn) {
208				$html.addClass("is-header-smaller");
209			} else {
210				if ($html.hasClass("is-header-smaller")) {
211					$html.removeClass("is-header-smaller");
212				}
213			}
214		});
215		// ------------------------------
216
217
218		// ------------------------------
219		// MOBILE MENU
220		var $menu = $('.nav-menu');
221
222		// wrap link text with spans (extra span markup is needed for menu link hover styles)
223		$menu.find('li:not(.menu-logo) a').wrapInner("<span class='link-text'></span>");
224
225		// add classes
226		$menu.find('li').each(function () {
227			if ($(this).children('ul').length) {
228				$(this).addClass('has-submenu');
229				$(this).find('> a, > a .link-text').append('<span class="submenu-toggle"></span>');
230			}
231		});
232
233		var $submenuTrigger = $('.has-submenu .submenu-toggle');
234		// submenu link click event
235		$submenuTrigger.on("click", function () {
236			$(this).parent().parent().toggleClass('active');
237			$(this).parent().siblings('ul').toggleClass('active');
238			return false;
239		});
240		// ------------------------------
241
242
243
244
245		// ------------------------------	
246		// SEARCH TOGGLE
247		$('.search-toggle').on("click", function (e) {
248			e.stopPropagation();
249			var search_input = $(this).parent().find('.search-container input[type="search"]');
250			$('html').toggleClass('is-search-toggled-on');
251			if ($('html').hasClass('is-search-toggled-on')) {
252				setTimeout(function () { search_input.trigger('focus'); }, 400);
253			}
254		});
255		// ------------------------------
256
257
258
259		// ------------------------------	
260		// HEADER MENU TOGGLE
261		$('.menu-toggle').on("click", function (e) {
262			e.stopPropagation();
263			$('html').toggleClass('is-menu-toggled-on');
264			$(this).parents('.site-navigation').toggleClass('is-active');
265			$(this).parents('.site-header').toggleClass('is-active');
266		});
267
268		// one page nav support with hash: close the mobile menu when clicked on an hash link
269		$('.nav-menu a[href*="#"]').on( "click", function() {
270			if (window.matchMedia("(max-width: 992px)").matches) { //needs to work only on mobile menu
271				$(this).parents('.site-navigation').find('.menu-toggle').trigger("click" );
272			}
273		});
274		// ------------------------------
275
276
277
278		/* Slider more-link clone */
279		$('.post-thumbnail .entry-header .more-link').each(function () {
280			$(this).clone().appendTo($(this).parents('.post-wrap')).addClass('outside');
281		});
282
283
284		var sliderAnimations = {
285
286			'backSlide': {
287				'in': 'backSlideInRight',
288				'out': 'backSlideOutLeft',
289				'backIn': 'backSlideInLeft',
290				'backOut': 'backSlideOutRight'
291			},
292			'scale': {
293				'in': 'scaleIn',
294				'out': 'scaleOut'
295			},
296			'stackScale': {
297				'in': 'scaleIn',
298				'out': 'zoomOut',
299				'backIn': 'zoomIn',
300				'backOut': 'scaleOut'
301			},
302			'stackZoom': {
303				'in': 'zoomIn',
304				'out': 'scaleOut',
305				'backIn': 'scaleIn',
306				'backOut': 'zoomOut'
307			},
308			'fade': {
309				'in': 'fadeIn',
310				'out': 'fadeOut'
311			},
312			'fadeHorizontal': {
313				'in': 'fadeInRight',
314				'out': 'fadeOutLeft',
315				'backIn': 'fadeInLeft',
316				'backOut': 'fadeOutRight'
317			},
318			'fadeHorizontalBig': {
319				'in': 'fadeInRightBig',
320				'out': 'fadeOutLeftBig',
321				'backIn': 'fadeInLeftBig',
322				'backOut': 'fadeOutRightBig'
323			},
324			'fadeVertical': {
325				'in': 'fadeInUp',
326				'out': 'fadeOutUp',
327				'backIn': 'fadeInDown',
328				'backOut': 'fadeOutDown'
329			},
330			'fadeVerticalBig': {
331				'in': 'fadeInUpBig',
332				'out': 'fadeOutUpBig',
333				'backIn': 'fadeInDownBig',
334				'backOut': 'fadeOutDownBig'
335			},
336			'jello': {
337				'in': 'jello',
338				'out': 'zoomOut'
339			},
340			'jelloVertical': {
341				'in': 'jello',
342				'out': 'fadeOutDown',
343				'backIn': 'jello',
344				'backOut': 'fadeOutUp'
345			},
346			'jelloVerticalBig': {
347				'in': 'jello',
348				'out': 'fadeOutDownBig',
349				'backIn': 'jello',
350				'backOut': 'fadeOutUpBig'
351			},
352			'jelloHorizontal': {
353				'in': 'jello',
354				'out': 'fadeOutLeft',
355				'backIn': 'jello',
356				'backOut': 'fadeOutRight'
357			},
358			'jelloHorizontalBig': {
359				'in': 'jello',
360				'out': 'fadeOutLeftBig',
361				'backIn': 'jello',
362				'backOut': 'fadeOutRightBig'
363			},
364			'swing': {
365				'in': 'swing',
366				'out': 'zoomOut'
367			},
368			'swingVertical': {
369				'in': 'swing',
370				'out': 'fadeOutDown',
371				'backIn': 'swing',
372				'backOut': 'fadeOutUp'
373			},
374			'swingVerticalBig': {
375				'in': 'swing',
376				'out': 'fadeOutDownBig',
377				'backIn': 'swing',
378				'backOut': 'fadeOutUpBig'
379			},
380			'swingHorizontal': {
381				'in': 'swing',
382				'out': 'fadeOutLeft',
383				'backIn': 'swing',
384				'backOut': 'fadeOutRight'
385			},
386			'swingHorizontalBig': {
387				'in': 'swing',
388				'out': 'fadeOutLeftBig',
389				'backIn': 'swing',
390				'backOut': 'fadeOutRightBig'
391			},
392			'rubberBand': {
393				'in': 'rubberBand',
394				'out': 'zoomOut'
395			},
396			'rubberBandVertical': {
397				'in': 'rubberBand',
398				'out': 'fadeOutUp',
399				'backIn': 'rubberBand',
400				'backOut': 'fadeOutDown'
401			},
402			'rubberBandVerticalBig': {
403				'in': 'rubberBand',
404				'out': 'fadeOutDownBig',
405				'backIn': 'rubberBand',
406				'backOut': 'fadeOutUpBig'
407			},
408			'rubberBandHorizontal': {
409				'in': 'rubberBand',
410				'out': 'fadeOutLeft',
411				'backIn': 'rubberBand',
412				'backOut': 'fadeOutRight'
413			},
414			'rubberBandHorizontalBig': {
415				'in': 'rubberBand',
416				'out': 'fadeOutLeftBig',
417				'backIn': 'rubberBand',
418				'backOut': 'fadeOutRightBig'
419			},
420			'zoom': {
421				'in': 'zoomIn',
422				'out': 'zoomOut'
423			},
424			'zoomHorizontal': {
425				'in': 'zoomIn',
426				'out': 'fadeOutLeft',
427				'backIn': 'fadeInLeft',
428				'backOut': 'zoomOut'
429			},
430			'zoomHorizontalBig': {
431				'in': 'zoomIn',
432				'out': 'fadeOutLeftBig',
433				'backIn': 'fadeInLeftBig',
434				'backOut': 'zoomOut'
435			},
436			'zoomVertical': {
437				'in': 'zoomIn',
438				'out': 'fadeOutUp',
439				'backIn': 'fadeInDown',
440				'backOut': 'zoomOut'
441			},
442			'zoomVerticalBig': {
443				'in': 'zoomIn',
444				'out': 'fadeOutUpBig',
445				'backIn': 'fadeInDownBig',
446				'backOut': 'zoomOut'
447			},
448			'zoomInDown': {
449				'in': 'zoomInDown',
450				'out': 'zoomOut'
451			},
452			'fadeUpZoomOut': {
453				'in': 'fadeInUp',
454				'out': 'zoomOut',
455				'backIn': 'zoomIn',
456				'backOut': 'fadeOutDown'
457			},
458			'fadeLeftZoomOut': {
459				'in': 'fadeInLeft',
460				'out': 'zoomOut',
461				'backIn': 'zoomIn',
462				'backOut': 'fadeOutLeft'
463			},
464			'flipVertical': {
465				'in': 'flipInX',
466				'out': 'zoomOut'
467			},
468			'flipHorizontal': {
469				'in': 'flipInY',
470				'out': 'zoomOut'
471			},
472			'lightSpeed': {
473				'in': 'lightSpeedInLeft',
474				'out': 'lightSpeedOutLeft',
475				'backIn': 'lightSpeedInRight',
476				'backOut': 'lightSpeedOutRight'
477			},
478			'jackInTheBox': {
479				'in': 'jackInTheBox',
480				'out': 'zoomOut'
481			},
482			'hinge': {
483				'out': 'hinge'
484			},
485			'rotate': {
486				'in': 'rotateIn',
487				'out': 'zoomOut',
488				'backIn': 'zoomIn',
489				'backOut': 'rotateOut'
490			},
491			'rotateUpSwitch': {
492				'in': 'rotateInUpRight',
493				'out': 'rotateOutDownRight'
494			},
495			'rotateDownSwitch': {
496				'in': 'rotateInDownRight',
497				'out': 'rotateOutUpRight'
498			},
499			'rotateHorizontal': {
500				'in': 'rotateInDownLeft',
501				'out': 'rotateOutUpRight',
502				'backIn': 'rotateInDownRight',
503				'backOut': 'rotateOutUpLeft'
504			},
505			'rotateVertical': {
506				'in': 'rotateInUpRight',
507				'out': 'rotateOutUpRight',
508				'backIn': 'rotateInDownRight',
509				'backOut': 'rotateOutDownRight'
510			},
511			'jumpIn': {
512				'in': 'jumpIn',
513				'out': 'zoomOut'
514			},
515			'blur': {
516				'in': 'blurIn',
517				'out': 'blurOut'
518			},
519			'blurZoom': {
520				'in': 'blurZoomIn',
521				'out': 'blurZoomOut'
522			},
523			'blurScale': {
524				'in': 'blurScaleIn',
525				'out': 'blurScaleOut'
526			},
527			'blurStackScale': {
528				'in': 'blurScaleIn',
529				'out': 'blurZoomOut',
530				'backIn': 'blurZoomIn',
531				'backOut': 'blurScaleOut'
532			},
533			'blurStackZoom': {
534				'in': 'blurZoomIn',
535				'out': 'blurScaleOut',
536				'backIn': 'blurScaleIn',
537				'backOut': 'blurZoomOut'
538			},
539			'invert': {
540				'in': 'invert'
541			}
542		};
543
544		// console.log('Total Slider Animations Count is ' + Object.keys(sliderAnimations).length);
545
546
547		// ------------------------------
548		// OWL-CAROUSEL
549		var owl = $('.owl-carousel');
550		$('.slider-box .post-thumbnail .entry-header').removeClass('ready');
551		if (owl.length) {
552			owl.each(function (index, element) {
553
554				var items = $(element).data('items');
555				var animate = $(element).data('animation');
556				//var animate = 'jello';
557				var animateIn, animateOut, backAnimateIn, backAnimateOut;
558				var mouseDrag = $(element).data('mouse-drag');
559
560				// check if the animations is defined
561				if (sliderAnimations[animate] !== undefined && items <= 1) {
562
563					// mouse drag is always of when custom animation is on
564					mouseDrag = false;
565					$(element).addClass('custom-animation');
566
567					animateIn = isIE ? 'fadeIn' : sliderAnimations[animate].in;
568					animateOut = isIE ? 'fadeOut' : sliderAnimations[animate].out;
569					backAnimateIn = isIE ? 'fadeIn' : sliderAnimations[animate].backIn;
570					backAnimateOut = isIE ? 'fadeOut' : sliderAnimations[animate].backOut;
571				}
572
573				//wait for images
574				$(element).imagesLoaded(function () {
575
576					//remove loading
577					$(element).find('.loading').remove();
578
579					$(element).owlCarousel({
580						mouseDrag: mouseDrag,
581						dots: $(element).data('dots'),
582						nav: $(element).data('nav'),
583						autoplay: $(element).data('autoplay'),
584						autoplayTimeout: $(element).data('autoplay-timeout'),
585						autoplayHoverPause: true,
586						navText: false,
587						rewind: $(element).data('rewind'),
588						center: $(element).data('center'),
589						loop: $(element).data('loop'),
590						// margin :				60,
591						// stagePadding: 		200,
592						navSpeed: 350,
593						dotsSpeed: 250,
594						responsiveRefreshRate: 10,
595						smartSpeed: 1000, // slide change animation duration when autoplay is on *this causes to unintended autoplay start on mobile after interacted with slider
596						autoHeight: true,
597						animateIn: animateIn,
598						animateOut: animateOut,
599						backAnimateIn: backAnimateIn,
600						backAnimateOut: backAnimateOut,
601						responsive: {
602							0: {
603								items: 1,
604								nav: true
605							},
606							700: {
607								items: items <= 2 ? items : 2,
608								nav: false
609							},
610							960: {
611								items: items <= 3 ? items : 3,
612								nav: true
613							},
614							1260: {
615								items: items <= 4 ? items : 4,
616								nav: true
617							}
618						},
619						onTranslated: function () {
620
621							// fix: slider always autoplays on mobile after interaction with the slider
622							if ($(element).data('autoplay') !== true) {
623								$(element).trigger('stop.owl.autoplay');
624							}
625						},
626						onInitialized: function () {
627
628
629							// ------------------------------
630							// PARALLAX
631							if (!isIE) {
632
633								var $container = $('.post-slider');
634								$('.post-slider .post-thumbnail').each(function () {
635									if ($(this).data('parallax-video')) { //parallax video
636										$(this).jarallax({
637											speed: 0,
638											zIndex: 1,
639											elementInViewport: $container,
640											videoSrc: $(this).data('parallax-video')
641										});
642									} else if ($('html').hasClass('is-slider-parallax')) { //parallax image
643										$(this).jarallax({
644											elementInViewport: $container,
645											zIndex: 1,
646											speed: 0.7,
647											disableParallax: function () {
648												return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
649											}
650										});
651									} // else if
652								}); // each
653
654							} // isIE
655							// ------------------------------
656
657
658							// responsive text
659							fitSliderTitle();
660							setTimeout(function () {
661								$('.post-thumbnail .entry-header').addClass('ready');
662							}, 300);
663
664							var fixWaitTime;
665							$(window).on('resize', function () {
666								clearTimeout(fixWaitTime);
667								fixWaitTime = setTimeout(function () {
668									fitSliderTitle();
669								}, 500);
670							});
671
672							// update sticky sidebar
673							sticky_sidebar_update();
674
675
676						} // onInitialized
677
678					}); // owlCarousel()
679
680
681					// listen for slider element self resize and refresh carousel : this fix many issues
682					new ResizeSensor($('.owl-carousel'), function () {
683						$(element).trigger('refresh.owl.carousel');
684					});
685
686
687					// fix for: nav = false not working
688					if ($(element).data('nav') !== true) {
689						$(element).find('.owl-nav').hide();
690					}
691
692
693				}); // wait for images
694
695
696
697
698			});	// owl.each()
699
700			function fitSliderTitle() {
701				$('.slider-box .entry-title').fitText($('html').data('title-ratio'), { minFontSize: '12px', maxFontSize: '220px' });
702			}
703		}
704		// ------------------------------
705
706
707
708
709		// ------------------------------
710		// PARALLAX
711		var video_parallax = $(".header-wrap, .intro, .post-thumbnail");
712
713		video_parallax.each(function () {
714			if ($(this).data('parallax-video')) {
715				$(this).jarallax({
716					speed: 0,
717					zIndex: 1,
718					videoSrc: $(this).data('parallax-video')
719				});
720			}
721		});
722
723		// PARALLAX HEADER BG IMAGE
724		$('.is-header-parallax .header-wrap').jarallax({
725			zIndex: 1,
726			speed: 0.6,
727			disableParallax: function () {
728				return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
729			}
730		});
731
732		// PARALLAX INTRO BG IMAGE
733		$('.is-intro-parallax .intro').jarallax({
734			zIndex: 1,
735			speed: 0.6,	//from -1.0 to 2.0,
736			disableParallax: function () {
737				return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
738			}
739		});
740
741		// PARALLAX LINK BOXES
742		if (!(isIE || isEdge)) { // buggy on IE : disable for now
743			$('.is-link-box-parallax .link-box .post-thumbnail').jarallax({
744				zIndex: 1,
745				speed: isSafari ? 0.5 : 0.7, // safari weird performance fix,
746				disableParallax: function () {
747					return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
748				}
749			});
750		}
751		// PARALLAX RELATED POSTS
752		if (!(isIE || isEdge)) { // buggy on IE : disable for now
753			$('.is-related-posts-parallax .related-posts .post-thumbnail').jarallax({
754				zIndex: 1,
755				speed: 0.8,
756				disableParallax: function () {
757					return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
758				}
759			});
760		}
761
762		// PARALLAX IMAGE IN POST
763		parallaxImages();
764		// ------------------------------
765
766
767
768
769		// ------------------------------
770		// POST THUMBNAILS
771		var post_thumbnail = $('.post-thumbnail');
772		if (post_thumbnail.length) {
773
774			singlePostParallax();
775
776
777
778			// optimized background images for various screens
779			post_thumbnail.each(function () {
780
781				var postThumbnail = $(this);
782				var parallax = postThumbnail.find('[id^="jarallax"] div');
783				var isParallax = parallax.length;
784				var parallaxRatio = (isParallax && postThumbnail.parent('.post-header-overlay-inline').length) ? 1.5 : 1;
785				var src = "";
786
787				if (postThumbnail.width() * window.devicePixelRatio * parallaxRatio > 1060) { // big screens
788					src = postThumbnail.data('large-image');
789				} else if (postThumbnail.width() * window.devicePixelRatio * parallaxRatio > 550) { // retina phones or tablets
790					src = postThumbnail.data('medium-image');
791				}
792
793				if (src !== "") {
794
795					$("<img />").attr("src", src).load(function () {
796						if (isParallax) {
797							parallax.css('background-image', 'url(' + src + ')');
798						} else {
799							postThumbnail.css('background-image', 'url(' + src + ')');
800						}
801					});
802				}
803
804			});
805
806			$('*:not(.slider-post) > .post-thumbnail .entry-header').addClass('ready');
807
808		}
809		// ------------------------------
810
811
812
813
814		// ------------------------------
815		// Fitvids.js : fluid width video embeds
816		$("body").fitVids({ customSelector: 'iframe[src*="facebook.com/plugins/video"], iframe[src*="facebook.com/video/embed"]' });
817		// preserve 16:9 aspect ratio for soundcloud embeds
818		// $('.hentry iframe[src*="soundcloud.com"]').wrap('<div class="fluid-audio fluid-width-video-wrapper"></div>');
819		$('.fluid-width-video-wrapper').wrap('<div class="media-wrap"></div>');
820		// ------------------------------
821
822
823		// ------------------------------
824		// FluidBox : Zoomable Images
825		setupFluidbox();
826		// ------------------------------
827
828
829
830		// ------------------------------
831		// FORM VALIDATION
832		// comment form validation fix
833		$('#commentform, .post-password-form, .mc4wp-form form, .mc4wp-form').addClass('validate-form');
834		$('#commentform').find('input,textarea').each(function (index, element) {
835			if ($(this).attr('aria-required') == "true") {
836				$(this).addClass('required');
837			}
838			if ($(this).attr('name') == "email") {
839				$(this).addClass('email');
840			}
841		});
842
843		// validate form
844		if ($('.validate-form').length) {
845			$('.validate-form').each(function () {
846				$(this).validate();
847			});
848		}
849		// ------------------------------
850
851
852
853
854		// ------------------------------
855		// GALLERY COLLAGE LAYOUT
856		collage();
857
858		var resizeTimer = null;
859		$(window).bind('resize', function () {
860
861			// hide all the images until we resize them
862			// set the element you are scaling i.e. the first child nodes of ```.Collage``` to opacity 0
863			$('.gallery figure').css("opacity", 0);
864			// set a timer to re-apply the plugin
865			if (resizeTimer) clearTimeout(resizeTimer);
866			resizeTimer = setTimeout(collage, 1200);
867			collage();
868		});
869		// ------------------------------
870
871
872		// ------------------------------
873		// LIGHTBOX - applied to gallery post format  a[href*=".jpg"]
874
875		// zoomable text links
876		$('.entry-content .lightbox').wrap("<span class='lightbox'></span>");
877
878		if ($('.lightbox, .gallery, .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').length) {
879			$('.lightbox, .gallery,  .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').each(function (index, element) {
880				var $media_box = $(this);
881				$media_box.magnificPopup({
882					delegate: '.lightbox, .gallery-item a[href$=".jpg"], .gallery-item a[href$=".jpeg"], .gallery-item a[href$=".png"], .gallery-item a[href$=".gif"]',
883					type: 'image',
884					image: {
885						markup: '<div class="mfp-figure">' +
886							'<div class="mfp-close"></div>' +
887							'<div class="mfp-img"></div>' +
888							'</div>' +
889							'<div class="mfp-bottom-bar">' +
890							'<div class="mfp-title"></div>' +
891							'<div class="mfp-counter"></div>' +
892							'</div>', // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button
893
894						cursor: 'mfp-zoom-out-cur', // Class that adds zoom cursor, will be added to body. Set to null to disable zoom out cursor. 
895						verticalFit: true, // Fits image in area vertically
896						tError: '<a href="%url%">The image</a> could not be loaded.' // Error message
897					},
898					gallery: {
899						enabled: true,
900						tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter
901					},
902					iframe: {
903						markup: '<div class="mfp-iframe-scaler">' +
904							'<div class="mfp-close"></div>' +
905							'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
906							'<div class="mfp-title">Some caption</div>' +
907							'</div>'
908					},
909					mainClass: 'mfp-zoom-in',
910					tLoading: '',
911					removalDelay: 300, //delay removal by X to allow out-animation
912					callbacks: {
913						markupParse: function (template, values, item) {
914							var title = "";
915							if (item.el.parents('.gallery-item').length) {
916								title = item.el.parents('.gallery-item').find('.gallery-caption').text();
917							} else {
918								title = item.el.attr('title') == undefined ? "" : item.el.attr('title');
919							}
920							//return title;
921							values.title = title;
922						},
923						imageLoadComplete: function () {
924							var self = this;
925							setTimeout(function () {
926								self.wrap.addClass('mfp-image-loaded');
927							}, 16);
928						},
929						close: function () {
930							this.wrap.removeClass('mfp-image-loaded');
931						},
932
933						beforeAppend: function () {
934
935							var self = this;
936
937							// square aspect ratio for soundcloud embeds
938							if (this.content.find('iframe[src*="soundcloud.com"]').length) {
939								self.wrap.addClass('is-soundcloud');
940							} else {
941								self.wrap.removeClass('is-soundcloud');
942							}
943
944							this.content.find('iframe').on('load', function () {
945								setTimeout(function () {
946									self.wrap.addClass('mfp-image-loaded');
947								}, 16);
948							});
949
950						}
951					},
952					closeBtnInside: false,
953					closeOnContentClick: true,
954					midClick: true
955				});
956			});
957		}
958		// ------------------------------
959
960
961
962		// ------------------------------
963		// MASONRY - ISOTOPE
964		$masonry_container = $('.masonry');
965		if ($masonry_container.length) {
966
967			$masonry_container.imagesLoaded(function () {
968				// initialize isotope
969				$masonry_container.isotope({
970					itemSelector: '.hentry',
971					layoutMode: $masonry_container.data('layout'),
972					transitionDuration: $masonry_container.hasClass('portfolio-grid') ? 400 : 0
973				});
974
975				setMasonry();
976				setTimeout(function () { $masonry_container.isotope(); }, 20);
977				// filters
978				if ($masonry_container.data('isotope')) {
979					var filters = $('.filters');
980					if (filters.length) {
981						filters.find('a').on("click", function () {
982							var selector = $(this).attr('data-filter');
983							$masonry_container.isotope({ filter: selector });
984							$(this).parent().addClass('current').siblings().removeClass('current');
985							return false;
986						});
987					}
988				}
989
990				// fix item widths on resize
991				$(window).on('resize', function () {
992					setMasonry();
993				});
994
995
996
997			}); // images loaded			
998		}
999		// ------------------------------
1000
1001
1002
1003
1004		// ------------------------------
1005		// FULL WIDTH IMAGES with caption fix
1006		if ($('figure img.full').length) {
1007			$('figure img.full').parent().addClass('full');
1008		}
1009		// ------------------------------
1010
1011
1012		// ------------------------------
1013		// HOME LANDING FULLSCREEN VIDEO
1014		var fs_video = $('.intro-vid');
1015		if (fs_video.length) {
1016			//fs_video.wrap( "<div class='fs-video'></div>" );
1017			//fs_video = $('.fs-video');
1018			bgVideo(fs_video);
1019			$(window).resize(function () {
1020				bgVideo(fs_video);
1021				//setTimeout(bgVideo(fs_video), 1500);
1022			});
1023		}
1024
1025		var resizeTimerVideo = null;
1026		$(window).bind('resize', function () {
1027			if (resizeTimerVideo) {
1028				clearTimeout(resizeTimerVideo);
1029			}
1030			resizeTimerVideo = setTimeout(bgVideo(fs_video), 200);
1031		});
1032		// ------------------------------
1033
1034
1035
1036		// ------------------------------
1037		// STICKY SIDEBAR
1038		sticky_sidebar();
1039
1040		// fix for : sticky sidebar overlap when resized to mobile view
1041		$(window).resize(function () {
1042			sticky_sidebar_update();
1043		});
1044		// ------------------------------
1045
1046
1047		// ------------------------------
1048		// LINK BOX FIT TEXT
1049		$('.link-box .entry-title').fitText($('html').data('link-box-title-ratio'), { minFontSize: '12px' });
1050		// ------------------------------
1051
1052
1053
1054		// ------------------------------
1055		// FIX HEADER
1056		fixHeader();
1057		$(window).resize(function () {
1058			fixHeader();
1059			setTimeout(function () { fixHeader(); }, 500); // wait for slider post resize
1060		});
1061		// ------------------------------
1062
1063
1064
1065		// ------------------------------
1066		// FULL SCREEN POST RATIO FIX 
1067		fixFsRatio();
1068		$(window).resize(function () {
1069			fixFsRatio();
1070			setTimeout(function () { fixFsRatio(); }, 500); // wait for slider post resize
1071		});
1072		// ------------------------------
1073
1074
1075
1076		// ------------------------------
1077		// https://getwaves.io/
1078		// https://tympanus.net/Development/SectionSeparators/
1079		// https://smooth.ie/blogs/news/svg-wavey-transitions-between-sections
1080		var headerShape = $('html').data('header-bg-shape');
1081		if (headerShape !== undefined) {
1082
1083			var headerSvg;
1084			switch (headerShape) {
1085				case "curtain":
1086					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 22" preserveAspectRatio="none"><path fill="currentColor" stroke="currentColor" d="M0 0 Q 2.5 40 5 0 Q 7.5 40 10 0 Q 12.5 40 15 0 Q 17.5 40 20 0 Q 22.5 40 25 0 Q 27.5 40 30 0 Q 32.5 40 35 0 Q 37.5 40 40 0 Q 42.5 40 45 0 Q 47.5 40 50 0 Q 52.5 40 55 0 Q 57.5 40 60 0 Q 62.5 40 65 0 Q 67.5 40 70 0 Q 72.5 40 75 0 Q 77.5 40 80 0 Q 82.5 40 85 0 Q 87.5 40 90 0 Q 92.5 40 95 0 Q 97.5 40 100 0 Z"></path></svg>';
1087					break;
1088				case "chevron":
1089					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 102" preserveAspectRatio="none">
1089<path fill="currentColor" stroke="currentColor" d="M0 0 L50 100 L100 0 Z"></path></svg>';
1090					break;
1091				case "round":
1092					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0.1 0.3 200 19" preserveAspectRatio="none"><g transform="translate(-0.21755166,-100.15454)"><path style="fill:currentColor;" d="M 0.2688579,100.29477 H 200.98548 c 0,0 -99.37375,39.84098 -200.7166221,0 z"></path></g></svg>'
1093					break;
1094				case "round_layers":
1095					headerSvg = '<svg viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 0v.48C18.62 9.38 297.81 140 639.5 140 993.24 140 1280 0 1280 0z" fill-opacity=".3"></path><path d="M0 .6c14 8.28 176.54 99.8 555.45 119.14C952.41 140 1280 0 1280 0H0z" fill-opacity=".5"></path><path d="M726.29 101.2C1126.36 79.92 1281 0 1281 0H1c.05 0 325.25 122.48 725.29 101.2z"></path></g></svg>';
1096					break;
1097				case "cut_left":
1098					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,0L720,128L1440,288L1440,0L720,0L0,0Z"></path></svg>';
1099					break;
1100				case "cut_left_round":
1101					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,64L120,101.3C240,139,480,213,720,250.7C960,288,1200,288,1320,288L1440,288L1440,0L1320,0C1200,0,960,0,720,0C480,0,240,0,120,0L0,0Z"></path></svg>';
1102					break;
1103				case "cut_right":
1104					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,320L1440,32L1440,0L0,0Z"></path></svg>';
1105					break;
1106				case "cut_right_round":
1107					headerSvg = '<svg viewBox="0 0 500 150" preserveAspectRatio="none"><path d="M-12.69,143.58 C107.50,141.61 373.87,152.45 522.29,-1.47 L500.00,0.00 L0.00,0.00 Z" style="stroke: none; fill: currentColor;"></path></svg>';
1108					break;
1109				case "wave_1":
1110					headerSvg = '<svg width="100%" height="120" viewBox="0.1 0.1 180 40" preserveAspectRatio="none"><g transform="translate(-18.298844,-77.973964)"><path style="fill:currentColor;" d="M 31.615583,86.351641 H 192.16499 v 26.901969 c 0,0 -32.03411,-14.237983 -59.62682,-12.72484 -22.34188,1.2252 -54.779359,9.72634 -54.779359,9.72634 0,0 -22.029534,3.62882 -34.471238,-1.88988 -12.441702,-5.51871 -11.67199,-22.013589 -11.67199,-22.013589 z"></path><path style="fill:currentColor;" d="M 18.441597,78.106256 H 198.58126 v 39.288614 c 0,0 -43.10672,-27.825245 -73.47599,-19.687823 -30.369264,8.137423 -46.832208,12.548653 -46.832208,12.548653 0,0 -32.775418,8.05972 -46.735258,0 C 17.577964,102.19598 18.441597,78.106256 18.441597,78.106256 Z"></path></g></svg>';
1111					break;
1112				case "wave_2":
1113					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"> <path fill="currentColor" fill-opacity="1" d="M0,160L16,176C32,192,64,224,96,202.7C128,181,160,107,192,101.3C224,96,256,160,288,186.7C320,213,352,203,384,208C416,213,448,235,480,218.7C512,203,544,149,576,122.7C608,96,640,96,672,112C704,128,736,160,768,160C800,160,832,128,864,101.3C896,75,928,53,960,90.7C992,128,1024,224,1056,218.7C1088,213,1120,107,1152,96C1184,85,1216,171,1248,213.3C1280,256,1312,256,1344,240C1376,224,1408,192,1424,176L1440,160L1440,0L1424,0C1408,0,1376,0,1344,0C1312,0,1280,0,1248,0C1216,0,1184,0,1152,0C1120,0,1088,0,1056,0C1024,0,992,0,960,0C928,0,896,0,864,0C832,0,800,0,768,0C736,0,704,0,672,0C640,0,608,0,576,0C544,0,512,0,480,0C448,0,416,0,384,0C352,0,320,0,288,0C256,0,224,0,192,0C160,0,128,0,96,0C64,0,32,0,16,0L0,0Z"></path></svg>';
1114					break;
1115				case "wave_3":
1116					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,128L60,112C120,96,240,64,360,48C480,32,600,32,720,80C840,128,960,224,1080,266.7C1200,309,1320,299,1380,293.3L1440,288L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path></svg>';
1117					break;
1118				case "ribbon":
1119					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none">
1119<path fill="currentColor" fill-opacity="1" d="M0,256L720,128L1440,256L1440,0L720,0L0,0Z"></path></svg>';
1120					break;
1121				case "ribbon_round":
1122					headerSvg = '<svg viewBox="0 0 500 150" preserveAspectRatio="none"><path d="M-12.13,150.48 C196.66,-30.09 318.00,-15.28 512.13,146.53 L500.84,-29.11 L-7.05,-11.34 Z" style="stroke: none; fill: currentColor;"></path></svg>';
1123					break;
1124				case "lines_1":
1125					headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,128L160,192L320,64L480,256L640,96L800,288L960,0L1120,256L1280,288L1440,0L1440,0L1280,0L1120,0L960,0L800,0L640,0L480,0L320,0L160,0L0,0Z"></path></svg>';
1126					break;
1127			}
1128
1129			// add svg to header or menu
1130			if ($('html').hasClass('is-menu-bottom')) {
1131				$('.site-header .menu-wrap').append(headerSvg);
1132				$('.site-header .menu-wrap > svg').addClass('header-bg-shape');
1133			} else {
1134				$('.site-header .header-wrap').append(headerSvg);
1135				$('.site-header .header-wrap > svg').addClass('header-bg-shape');
1136			}
1137
1138
1139		}
1140		// END: HEADER SVG SHAPES 
1141		//  ------------------------------
1142
1143
1144		//  ------------------------------
1145		// STICKY AUDIO EMBEDS 
1146		if($('html.is-audio-embeds-sticky body.single-post').length) {
1147			$('iframe[src*="spotify.com"],iframe[src*="podbean.com"],iframe[src*="soundcloud.com"],iframe[src*="simplecast.com"],iframe[src*="tunein.com"],iframe[src*="anchor.fm"],iframe[src*="radiopublic.com"],iframe[src*="castbox.fm"],iframe[src*="iheart.com"],iframe[src*="libsyn.com"],iframe[src*="deezer.com"],iframe[src*="mixcloud.com"],iframe[src*="buzzsprout.com"],iframe[src*="spreaker.com"],iframe[src*="cadence13.com"],iframe[src*="ausha.co"],iframe[src*="podomatic.com"],iframe[src*="blogtalkradio.com"],iframe[src*="megaphone.fm"],iframe[src*="transistor.fm"], iframe[src*="captivate.fm"]').addClass('sticky-audio');
1148
1149			var sticky_audio_height = $('.sticky-audio').height();
1150			$('html').css('padding-bottom', sticky_audio_height);
1151			if($('html').hasClass('is-sidebar-sticky')) {
1152				$('.sidebar-wrap').css('padding-bottom', sticky_audio_height );
1153			}
1154		}
1155		// END: STICKY AUDIO EMBEDS 
1156		//  ------------------------------
1157
1158
1159
1160	});
1161	// DOCUMENT READY
1162
1163
1164
1165
1166	// WINDOW ONLOAD
1167	window.onload = function () {
1168
1169		/* FIX HEADER */
1170		fixHeader();
1171
1172		// FULL SCREEN POST RATIO FIX 
1173		fixFsRatio();
1174		setTimeout(function () { fixHeader(); fixFsRatio(); }, 500); // yet another fix for IE11 $#½$#£#
1175
1176
1177		sticky_sidebar_update();
1178
1179		// html addclass : loaded
1180		$('html').addClass('loaded');
1181
1182		// intro video bg
1183		bgVideo($('.intro-vid'));
1184
1185
1186
1187
1188		// ------------------------------
1189		// NOT FINAL * 
1190		// should be compatible with elements which height is longer than viewport
1191		// you may check : https://codepen.io/BoyWithSilverWings/pen/MJgQqR
1192
1193		// ------------------------------
1194		// Blur Slider Image On Scroll
1195		if ($('html').hasClass('is-slider-image-blur-on-scroll')) {
1196			blurItemOnScroll('.featured-area .post-slider .post-wrap + div');
1197		}
1198		// ------------------------------
1199
1200
1201		// ------------------------------
1202		// Blur Link Box Image On Scroll
1203		if ($('html').hasClass('is-link-box-image-blur-on-scroll')) {
1204			blurItemOnScroll('.featured-area .link-box .post-wrap + div');
1205		}
1206		// ------------------------------
1207
1208		// ------------------------------
1209		// Blur Featured Image On Scroll
1210		if ($('html').hasClass('is-featured-image-blur-on-scroll')) {
1211			blurItemOnScroll('.featured-image img');
1212			blurItemOnScroll('.top-content-single .post-wrap + div');
1213			blurItemOnScroll('.top-content-single iframe');
1214		}
1215		// ------------------------------
1216		// ------------------------------
1217		// NOT FINAL * 
1218
1219
1220	};
1221	// WINDOW ONLOAD
1222
1223
1224
1225
1226	// -------------------------------------------------
1227	// FUNCTIONS
1228
1229
1230	// ------------------------------
1231	// BLUR ITEM ON SCROLL
1232	function blurItemOnScroll(item) {
1233		if ($(item).length) {
1234			$(window).scroll(function () {
1235				$(item).each(function (index) {
1236					// console.log($(item).offset().top);
1237					var oVal = ($(window).scrollTop() - $(this).offset().top) / 50;
1238					oVal = oVal < 1 ? 0 : oVal;
1239					var filterVal = 'blur(' + oVal + 'px)';
1240					$(this)
1241						.css('filter', filterVal)
1242						.css('webkitFilter', filterVal)
1243						.css('mozFilter', filterVal)
1244						.css('oFilter', filterVal)
1245						.css('msFilter', filterVal);
1246				});
1247
1248
1249			});
1250		}
1251	}
1252	// ------------------------------
1253
1254
1255	// ------------------------------
1256	// FIX HEADER 
1257	function fixHeader() {
1258
1259		/* HEADER FLOATING - negative margin for the containers that comes after header */
1260		if ($('html').hasClass('is-header-float')) {
1261
1262			var headerHeight =
1263				parseInt($('.site-header:not(.clone)').outerHeight()) +
1264				parseInt($('.site-header:not(.clone)').css('marginTop') +
1265					parseInt($('.site-header:not(.clone) .header-wrap').css('marginTop')));
1266
1267			//console.log(-parseInt($('.site-header:not(.clone) .header-wrap').css('marginTop')));
1268			headerHeight = $('.top-bar').length ? headerHeight + parseInt($('.top-bar').outerHeight()) : headerHeight;
1269			$('.top-content, .site-header + .site-main, .top-content-single, .site-header ~ .elementor').css('marginTop', '-' + ++headerHeight + 'px');
1270
1271		}
1272		/* END: HEADER FLOATING  */
1273
1274
1275		/* MENU TOP LOGO OVERFLOW - positive margin for the container that c
1275omes after header */
1276		if (!($('html').hasClass('is-header-float')) && $('html').is('.is-menu-top.is-logo-overflow')) {
1277
1278			var headerHeight = parseInt($('.site-header:not(.clone) .site-branding').outerHeight()) / 2;
1279			$('.site-header:not(.clone) .header-wrap').css('marginBottom', '-' + headerHeight + 'px');
1280			$('.site-header + .site-main').css('marginTop', + headerHeight + 'px');
1281
1282		}
1283		/* END: MENU TOP LOGO OVERFLOW */
1284
1285
1286		/* MENU BOTTOM OVERFLOW - positive margin for the container that comes after header */
1287		if (!($('html').hasClass('is-header-float')) && $('html').is('.is-menu-bottom.is-menu-bottom-overflow')) {
1288
1289			var headerHeight = parseInt($('.site-header:not(.clone) .site-navigation:not(.clone)').outerHeight()) / 2;
1290			$('.site-header:not(.clone) .site-navigation:not(.clone)').css('marginBottom', '-' + headerHeight + 'px');
1291			$('.site-header + .site-main').css('marginTop', + headerHeight + 'px');
1292
1293		}
1294		/* END: MENU BOTTOM OVERFLOW  */
1295
1296
1297		/* HEADER VERTICAL */
1298		var isHeaderVertical = $('html').hasClass('is-header-vertical'),
1299			isHeaderVerticalLeft = $('html').hasClass('is-header-vertical-left'),
1300			isHeaderVerticalRight = $('html').hasClass('is-header-vertical-right');
1301
1302		if (isHeaderVertical) {
1303
1304			var header = $('.site-header');
1305
1306			// SubMenu padding top fix for all browsers and for all level submenus
1307			$('.nav-menu li.has-submenu').each(function () {
1308				$(this).find('ul').css("padding-top", ($(this).offset().top - $(window).scrollTop()) + 'px');
1309			});
1310
1311			// header vertical left : fix for 1st level submenu left for all browsers 
1312			if (isHeaderVerticalLeft) {
1313				$('.nav-menu > ul > li > ul').css("left", (header.offset().left + header.width()) + 'px');
1314			}
1315
1316			// header vertical right : fix for 1st level submenu right for all browsers 
1317			if (isHeaderVerticalRight) {
1318				var offsetRight = ($(window).width() - (header.offset().left + header.outerWidth()));
1319				var right = header.width() + offsetRight - 1;
1320				$('.nav-menu > ul > li > ul').css("right", right + 'px');
1321			}
1322
1323			// IE 11 3rd level submenu left fix
1324			if (isIE) {
1325				$('.nav-menu ul ul ul').each(function () {
1326					// find out how many parent ul element there is of this submenu
1327					var depth = $(this, ".nav-menu").parents("ul").length;
1328					var subWidth = $('.nav-menu ul ul').width();
1329
1330					if (isHeaderVerticalLeft) {
1331						$(this).css("left", (header.offset().left + header.width() + (subWidth * --depth)) + 'px');
1332					}
1333					else if (isHeaderVerticalRight) {
1334						var offsetRight = ($(window).width() - header.offset().left);
1335						var right = (subWidth * --depth) + offsetRight;
1336						$(this).css("right", right + 'px');
1337					}
1338				});
1339			} //end if isIE
1340
1341
1342		} // end if isHeaderVertical
1343		/* END: HEADER VERTICAL */
1344
1345
1346	} // end fixHeader()
1347	// ------------------------------
1348
1349
1350	// ------------------------------
1351	// FIX FS RATIO for slider post
1352	function fixFsRatio() {
1353		if (!($('html').hasClass('is-header-float'))) {
1354
1355			var headerHeight = parseInt($('.site-header:not(.clone').outerHeight()) + parseInt($('.site-header:not(.clone)').css('marginTop'));
1356
1357			/* menu top logo overflow fix */
1358			headerHeight = $('html').is('.is-menu-top.is-logo-overflow') ? headerHeight - (parseInt($('.site-header:not(.clone) .site-branding').outerHeight()) / 2) : headerHeight;
1359
1360			/* header vertical fix */
1361			headerHeight = $('html').hasClass('is-header-vertical') ? 0 : headerHeight;
1362
1363			/* add top-bar height too */
1364			headerHeight = $('.top-bar').length ? headerHeight + parseInt($('.top-bar').outerHeight()) : headerHeight;
1365
1366			// fix for 1px empty space from bottom - sometimes
1367			headerHeight--;
1368
1369			$('.ratio-fs .post-wrap').css('minHeight', 'calc(100vh - ' + headerHeight + 'px)');
1370
1371		}
1372	}
1373	// ------------------------------
1374
1375
1376	// ------------------------------
1377	// SINGLE POST PARALLAX
1378	function singlePostParallax() {
1379		// PARALLAX OVERLAY POST OVERLAY MEDIUM
1380		$('.is-top-content-single-medium .post-thumbnail').jarallax({
1381			zIndex: 1,
1382			speed: 0.6,
1383			disableParallax: function () {
1384				return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
1385			}
1386		});
1387
1388		// PARALLAX OVERLAY POST OVERLAY FULL/FULL MARGINS
1389		$('.is-top-content-single-full .post-thumbnail, .is-top-content-single-full-screen .post-thumbnail, .is-top-content-single-full-margins .post-thumbnail').jarallax({
1390			zIndex: 1,
1391			speed: 0.6,
1392			disableParallax: function () {
1393				return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
1394			}
1395		});
1396
1397		// PARALLAX OVERLAY POST OVERLAY INLINE
1398		$('.post-header-overlay-inline .post-thumbnail').jarallax({
1399			zIndex: 1,
1400			speed: 0.7,
1401			disableParallax: function () {
1402				return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
1403			}
1404		});
1405
1406	}
1407	// ------------------------------
1408
1409
1410
1411	// ------------------------------
1412	// STICKY SIDEBAR
1413	var stickySidebar;
1414	function sticky_sidebar() {
1415
1416		if ($('.is-sidebar-sticky #secondary').length) {
1417			jQuery.support.touch = 'ontouchend' in document;
1418			if (window.matchMedia("(min-width: 992px)").matches && !(jQuery.support.touch) && ($('#primary').height() > $('#secondary').height())) {
1419
1420				stickySidebar = new StickySidebar('#secondary', {
1421					topSpacing: 80,
1422					bottomSpacing: 20,
1423					resizeSensor: true,
1424					containerSelector: '.site-main > div',
1425					innerWrapperSelector: '.sidebar-wrap'
1426				});
1427
1428			}
1429		}
1430	}
1431	// ------------------------------
1432
1433
1434	// ------------------------------
1435	// UPDATE STICKY SIDEBAR
1436	function sticky_sidebar_update() {
1437		if ($('.is-sidebar-sticky #secondary').length) {
1438			jQuery.support.touch = 'ontouchend' in document;
1439			if (window.matchMedia("(min-width: 992px)").matches && !(jQuery.support.touch) && ($('#primary').height() > $('#secondary').height())) {
1440
1441				stickySidebar.updateSticky();
1442
1443			}
1444			// fix for : sticky sidebar overlap when resized to mobile view
1445			if (window.matchMedia("(max-width: 991px)").matches) {
1446
1447				if (stickySidebar) {
1448					stickySidebar.destroy();
1449				}
1450
1451			}
1452		}
1453	}
1454	// ------------------------------
1455
1456
1457	// ------------------------------
1458	// FULL SCREEN BG VIDEO
1459	function bgVideo(fs_video) {
1460
1461		var videoW = fs_video.find('iframe, video').width(),
1462			videoH = fs_video.find('iframe, video').height(),
1463			screenW = $('.intro').outerWidth(),
1464			screenH = $('.intro').outerHeight();
1465
1466		var video_ratio = videoW / videoH;
1467		var screen_ratio = screenW / screenH;
1468
1469		if (video_ratio > screen_ratio) {
1470			var diffW = screenH / videoH;
1471			var newWidth = videoW * diffW;
1472			fs_video.css({ 'width': newWidth, 'margin-left': -((newWidth - screenW) / 2), 'margin-top': 0 });
1473		} else {
1474			var diffH = screenH / videoH;
1475			var newHeight = screenH * diffH;
1476			fs_video.css({ 'width': "100%", 'margin-left': 0, 'margin-top': -((videoH - screenH) / 2) });
1477		}
1478	}
1479	// ------------------------------
1480
1481
1482
1483	// ------------------------------
1484	// FULL WIDTH PARALLAX IMAGES
1485	function parallaxImages() {
1486		$('img.parallax').each(function (index, element) {
1487
1488			var img = $(element);
1489			$('<div class="parallax-image"></div>').insertBefore(img);
1490			var wrapper = img.prev('.parallax-image');
1491			wrapper.css('background-image', 'url(' + img.attr('src') + ')');
1492
1493			if (img.hasClass('half')) {
1494				wrapper.addClass('half');
1495			}
1496
1497			var isIE = document.documentMode || /Edge/.test(navigator.userAgent);
1498			if (!isIE) {
1499				img.imagesLoaded(function () {
1500
1501					// PARALLAX EFFECT
1502					var aspect_ratio = img.width() / img.height();
1503					var speed = aspect_ratio > 1.2 ? 0.2 : -0.9;
1504					speed = $('.content-area').hasClass('with-sidebar') ? 0.2 : speed;
1505					wrapper.jarallax({
1506						zIndex: 1,
1507						speed: speed,
1508						disableParallax: function () {
1509							return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent);
1510						}
1511					});
1512
1513				});
1514			}
1515		});
1516	}
1517	// ------------------------------
1518
1519
1520
1521
1522	// ------------------------------
1523	// FluidBox : Zoomable Images
1524	function setupFluidbox() {
1525
1526		$('.entry-content > p a, .wp-caption a, a.zoom').each(function () {
1527
1528			// prevent conflict with the woocommerce lightbox - both have zoom class
1529			if ($('body').hasClass('woocommerce')) {
1530				return;
1531			}
1532			if ($(this).attr('href').match(/\.(jpeg|jpg|gif|png)$/) !== null) {
1533				$(this).fluidbox({
1534					viewportFill: 0.8,
1535					immediateOpen: true,
1536					loader: false,
1537					stackIndex: 400
1538				});
1539			}
1540		});
1541	}
1542	// ------------------------------
1543
1544
1545
1546	// ------------------------------
1547	// GALLERY COLLAGE LAYOUT
1548	function collage() {
1549		var collage = $('.gallery');
1550		if (collage.length) {
1551
1552			collage.each(function (index, el) {
1553
1554				// wait for images to be loaded
1555				$(el).imagesLoaded(function () {
1556
1557					$(el).removeClass('pw-collage-loading');
1558					$(el).collagePlus({
1559
1560						//'targetHeight' : collage.data('row-height'),
1561						'targetHeight': 360,
1562						'effect': 'effect-4',
1563						'allowPartialLastRow': false
1564
1565					}); //collagePlus()
1566
1567				}); //imagesLoaded()
1568
1569			}); //each
1570		}
1571	}
1572	// ------------------------------
1573
1574
1575
1576	// ------------------------------
1577	// MASONRY LAYOUT : changes the number of masonry columns based on the current container's width
1578	function setMasonry() {
1579
1580		var itemW = $masonry_container.data('item-width');
1581		var containerW = $masonry_container.width();
1582		var items = $masonry_container.children('.hentry');
1583		var columns = Math.round(containerW / itemW);
1584		$masonry_container.removeClass('col-1 col-2 col-3 col-4- col-5 col-6 col-7- col-8').addClass('col-' + columns);
1585
1586		// set the widths (%) for each of item
1587		items.each(function (index, element) {
1588			var multiplier = ($masonry_container.hasClass('first-full') && index === 0) && columns > 1 ? 2 : 1;
1589			var itemRealWidth = (Math.floor(containerW / columns) * 100 / containerW) * multiplier;
1590			itemRealWidth = itemRealWidth > 100 ? 100 : itemRealWidth;
1591			$(this).css('width', itemRealWidth + '%');
1592		});
1593
1594		var columnWidth = Math.floor(containerW / columns);
1595		$masonry_container.isotope('option', { masonry: { columnWidth: columnWidth } });
1596	}
1597	// ------------------------------
1598
1599
1600
1601})(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.