PageSourceSearch

https://distritoagencia.com/wp-content/themes/nui/includes/js/theme.js

js distritoagencia.com collected 2026-10-05 22:10:43 UTC 111,994 bytes, 3,255 lines download raw bytes

1/* =================================================================
2* Template JS
3* 
4* Template:    Nui - Creative Portfolio WordPress Theme
5* Author:      webRedox
6* URL:         https://webredox.net/
7================================================================= */
8
9
10// Table of Content
11// =================
12// Detect browser
13// Detect mobile device
14// Page transitions
15// Smooth Scrollbar
16// Image lazy loading
17// Main menu (classic)
18// Overlay menu 
19// Portfolio slider (full screen)
20// Portfolio carousel (full screen carousel)
21// Portfolio hover carousel (full screen carousel)
22// Blog carousel
23// Content carousel
24// Testimonials slider
25// Isotope
26// lightGallery
27// Page header
28// Next project
29// GSAP ScrollTrigger plugin
30// Portfolio thumbnail list
31// Portfolio interactive
32// Portfolio split
33// Portfolio list
34// Portfolio grid
35// tt-Gallery
36// Accordion
37// Sidebar (classic)
38// Sliding sidebar
39// Scrolling text
40// Scroll between anchors 
41// Scroll to top 
42// Defer videos
43// Forms
44// Magic cursor
45// Template style switch
46// Miscellaneous
47//
48
49
50
51
52(function ($) {
53	'use strict';
54
55
56
57	// ========================================
58	// Detect browser and add class to </body>
59	// ========================================
60
61	// Detect Firefox
62	let firefoxAgent = navigator.userAgent.indexOf("Firefox") > -1;
63
64	// Add class "is-firefox" to </body>
65	if(firefoxAgent) {
66		$("body").addClass("is-firefox");
67	}
68
69
70
71	// ==============================================
72	// Detect mobile device and add class to </body>
73	// ==============================================
74
75	// ==============================================
76	// Detect touch device (do not remove!!!)
77	// Info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#mobile_device_detection
78	// ==============================================
79
80	// Detect mobile device (Do not remove!!!)
81	var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Nokia|Opera Mini/i.test(navigator.userAgent) ? true : false;
82
83	// Add class "is-mobile" to </body>
84	if(isMobile) {
85		jQuery("body").addClass("is-mobile");
86	}
87	
88
89
90	// =================
91	// Page transitions
92	// =================
93
94	if ($("body").hasClass("tt-transition")) {
95		
96		// Wait until the whole page is loaded.
97		$(window).on("load", function () {
98			setTimeout(function(){
99				HideLoad(); // call out animations.
100			}, 0);
101		});
102
103
104		// Transitions In (when "ptr-overlay" slides in).
105		// =================
106		function RevealLoad() {
107			var tl_transitIn = gsap.timeline({ defaults: { duration: 1.5, ease: Expo.easeInOut }});
108
109				if ($("#page-transition").length) {
110					 tl_transitIn.set("#page-transition", { autoAlpha: 1 });
111					 tl_transitIn.to(".ptr-overlay", { scaleY: 1, transformOrigin: "center bottom" }, 0);
112					 tl_transitIn.to(".ptr-preloader", { autoAlpha: 1 }, 0.4);
113				}
114				tl_transitIn.to("#content-wrap", { y: -80, autoAlpha: 0 }, 0);
115				tl_transitIn.to("#tt-header", { y: -20, autoAlpha: 0 }, 0);
116		}
117
118
119		// Transitions Out (when "ptr-overlay" slides out)
120		// ================
121		function HideLoad() {
122			var tl_transitOut = gsap.timeline();
123
124				 if ($("#page-transition").length) {
125					tl_transitOut.to(".ptr-preloader", { duration: 1.5, autoAlpha: 0, ease: Expo.easeInOut });
126					tl_transitOut.to(".ptr-overlay", { duration: 1.5, scaleY: 0, transformOrigin: "center top", ease: Expo.easeInOut }, 0.3);
127				 }
128
129				 // tt-Header appear
130				 tl_transitOut.from("#tt-header", { duration: 1.5, y: 20, autoAlpha: 0, ease: Expo.easeInOut, clearProps:"all" }, 0.6);
131
132				 // tt-Footer appear
133				 tl_transitOut.from("#tt-footer", { duration: 1.5, y: 20, autoAlpha: 0, ease: Expo.easeInOut, clearProps:"all" }, 0.2);
134
135				 // Page header image appear
136				 if ($(".ph-image").length) {
137				 	if ($("#page-header").hasClass("ph-bg-image")) {
138				 		tl_transitOut.from(".ph-image img, .ph-video", { duration: 2, y: 80, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 0.8);
139				 	} else {
140				 		tl_transitOut.from(".ph-image", { duration: 2, y: 80, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 1.2);
141				 	}
142				 }
143				 
144				 // Page header elements appear (elements with class "ph-appear")
145				 var $phAppear = $(".ph-appear");
146				 if ($phAppear.length) {
147				 	tl_transitOut.from($phAppear, { duration: 2, y: 40, autoAlpha: 0, stagger: 0.3, ease: Expo.easeOut, clearProps:"all" }, 1.5);
148				 }
149
150				 // Portfolio interactive elements appear
151				 var $pi = $(".portfolio-interactive");
152				 var $piItem = $(".portfolio-interactive-item");
153				 var $piGhost = $(".portfolio-interactive-ghost");
154				 var $piPagination = $(".portfolio-interactive .tt-pagination");
155
156				 if ($pi.length) {
157				 	if ($pi.hasClass("pi-full")) {
158
159				 		if ($pi.hasClass("pi-inline")) {
160					 		tl_transitOut.from($piItem, { duration: 2, y: 60, autoAlpha: 0, stagger: 0.15, ease: Expo.easeOut, clearProps:"all" }, 1.3);
161					 	} else {
162					 		tl_transitOut.from($piItem, { duration: 2, y: 100, autoAlpha: 0, stagger: 0.15, ease: Expo.easeOut, clearProps:"all" }, 1.3);
163					 	}
164
165					 	if ($piGhost.length) {
166					 		$piGhost.wrapInner('<div class="pi-ghost-appear"></div>')
167					 		tl_transitOut.from(".pi-ghost-appear", { duration: 2, y: 80, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 1.5);
168					 	}
169
170					 	if ($piPagination.length) {
171					 		$piPagination.wrap('<div class="pi-pagination-appear"></div>')
172					 		tl_transitOut.from(".pi-pagination-appear", { duration: 2, y: 60, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 3);
173					 	}
174				 	}
175				 }
176
177				 // Portfolio split elements appear
178				 var $portfolioSplit = $(".portfolio-split");
179				 var $psplItem = $(".portfolio-split-item");
180				 var $psplImages = $(".pspl-images-inner");
181				 var $psplGhost = $(".pspl-ghost");
182				 if ($portfolioSplit.length) {
183				 	tl_transitOut.from($psplItem, { duration: 2, y: 40, autoAlpha: 0, stagger: 0.1, ease: Expo.easeOut, clearProps:"all" }, 1.3);
184				 	tl_transitOut.from($psplImages, { duration: 2, scale: 1.1, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 1);
185				 	if ($portfolioSplit.hasClass("pspl-reverse")) {
186				 		tl_transitOut.from($psplGhost, { duration: 2, x: 40, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 2);
187				 	} else {
188				 		tl_transitOut.from($psplGhost, { duration: 2, x: -40, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 2);
189				 	}
190				 }
191
192				 // Portfolio slider appear (full screen slider)
193				 var $portfolioSlider = $(".tt-portfolio-slider");
194				 var $psiElem = $(".tt-psc-elem");
195				 if ($portfolioSlider.length) {
196				 	tl_transitOut.from($portfolioSlider, { duration: 2, autoAlpha: 0, y: 40, ease: Expo.easeOut, clearProps:"all" }, 1);
197				 	if ($psiElem.length) {
198				 		$psiElem.wrap('<div class="tt-ps-appear"></div>');
199				 		tl_transitOut.fromTo((".tt-ps-appear"), { autoAlpha: 0, x: 40, scaleX: 1.1, transformOrigin: "left" }, { duration: 1.5, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", stagger: 0.15, ease: Expo.easeOut, clearProps:"all" }, 1.4);
200				 	}
201				 }
202
203				 // Portfolio carousel appear
204				 var $portfolioCarousel = $(".tt-portfolio-carousel");
205				 var $pciTitle = $(".tt-pci-title");
206				 var $pciCategory = $(".tt-pci-category");
207				 if ($portfolioCarousel.length) {
208				 	tl_transitOut.from($portfolioCarousel, { duration: 2, autoAlpha: 0, y: 40, ease: Expo.easeOut, clearProps:"all" }, 1);
209				 	if ($pciTitle.length) {
210				 		tl_transitOut.fromTo($pciTitle, { autoAlpha: 0, x: 100, scaleX: 1.3, transformOrigin: "left" }, { duration: 1.5, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", ease: Expo.easeOut, clearProps:"all" }, 1.4);
211				 	}
212				 	if ($pciCategory.length) {
213				 		tl_transitOut.fromTo($pciCategory, { autoAlpha: 0, x: 60, scaleX: 1.3, transformOrigin: "left" }, { duration: 1.5, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", ease: Expo.easeOut, clearProps:"all" }, 1.6);
214				 	}
215				 }
216
217				 // Portfolio hover carousel appear
218				 var $portfolioHoverCarousel = $(".tt-portfolio-hover-carousel");
219				 var $portfolioHoverCarouselImages = $(".tt-portfolio-hover-carousel-images");
220				 var $portfolioHoverCarouselItem = $portfolioHoverCarousel.find(".swiper-slide-visible").find(".tt-phc-item");
221				 var $portfolioHoverCarouselCounter = $(".tt-phc-counter");
222				 if ($portfolioHoverCarousel.length) {
223				 	if ($portfolioHoverCarouselImages.length) {
224				 		tl_transitOut.from($portfolioHoverCarouselImages, { duration: 2, autoAlpha: 0, y: 40, ease: Expo.easeOut, clearProps:"all" }, 1);
225				 	}
226				 	if ($portfolioHoverCarouselItem.length) {
227				 		tl_transitOut.from($portfolioHoverCarouselItem, { duration: 2, autoAlpha: 0, x: 180, scaleX: 1.3, stagger: 0.15, ease: Expo.easeOut, clearProps:"all" }, 1.4);
228				 	}
229				 	if ($portfolioHoverCarouselCounter.length) {
230				 		tl_transitOut.from($portfolioHoverCarouselCounter, { duration: 2, y: 20, autoAlpha: 0, ease: Expo.easeInOut, clearProps:"all" }, 0.4);
231				 	}
232
233				 	setTimeout(function(){
234						$portfolioHoverCarousel.addClass("tt-phc-ready");
235					}, 2000);
236				 }
237
238				 // Sliding sidebar trigger appear
239				 var $ssWrap = $(".tt-sliding-sidebar-wrap");
240				 var $ssTrigger = $(".tt-sliding-sidebar-trigger");
241				 if ($ssWrap.length) {
242					 if(!isMobile) {
243						 if ($ssWrap.hasClass("tt-ss-right")) {
244						 	tl_transitOut.from($ssTrigger, { duration: 1.5, autoAlpha: 0, x: 50, ease: Expo.easeOut }, 2);
245						 } else {
246						 	tl_transitOut.from($ssTrigger, { duration: 1.5, autoAlpha: 0, x: -50, ease: Expo.easeOut }, 2);
247						 }
248					 } else {
249					 	tl_transitOut.from($ssTrigger, { duration: 1.5, autoAlpha: 0, y: 20, ease: Expo.easeOut }, 2);
250					 }
251				 }
252
253				 // Blog elements appear
254				 var $blogElem = $("#blog-list, .tt-blog-post, .tt-sidebar");
255				 if ($blogElem.length) {
256				 	tl_transitOut.from($blogElem, { duration: 2, autoAlpha: 0, y: 80, ease: Expo.easeOut, clearProps:"all" }, 1);
257				 }
258				 
259				 // Page other elements appear
260				 if ($("#page-content").length) {
261				 	tl_transitOut.from("#page-content", { duration: 2, autoAlpha: 0, ease: Expo.easeOut, clearProps:"all" }, 1);
262				 }
263				 
264				 if ($("#page-transition").length) {
265				 	tl_transitOut.set("#page-transition", { duration: 1.5, autoAlpha: 0, ease: Expo.easeInOut });
266				 }
267		}
268
269
270		// Force page a reload when browser "Back" button click.
271		// =====================================================
272		window.onpageshow = function (event) {
273			if (event.persisted) {
274				window.location.reload();
275			}
276		}
277
278
279		// On link click
280		// ==============
281		$("a")
282			.not('[target="_blank"]') // omit from selection
283			.not('[href^="#"]') // omit from selection
284			.not('[href^="mailto"]') // omit from selection
285			.not('[href^="tel"]') // omit from selection
286			.not(".lg-trigger") // omit from selection
287			.not(".tt-btn-disabled") // omit from selection
288			.not(".no-transition") // omit from selection
289			.not(".comment-reply-link") // omit from selection
290			.not("#cancel-comment-reply-link") // omit from selection
291			.not(".lg-share") // omit from selection
292			.not(".elementor-gallery-item") // omit from selection
293			.not(".elementor-widget-image a") // omit from selection
294			.not(".elementor-widget-image-gallery a") // omit from selection
295			.not(".eae-gallery-item-inner a") // omit from selection
296			.not(".exad-fg-icons a") // omit from selection
297			.not(".elementor-toggle-title") // omit from selection
298			.not(".elementor-accordion-title") // omit from selection
299			.not(".lfb_btn-next") // omit from selection
300			.not(".linkPrevious") // omit from selection
301			.not(".lfb_btnNextContainer a.btn") // omit from selection
302			.on('click', function(e) {
303				e.preventDefault();
304
305				setTimeout(function (url) {
306					window.location = url
307				}, 1500, this.href);
308				
309				RevealLoad(); // call in animations.
310		});
311
312	}
313
314
315
316	// =======================================================================================
317	// Smooth Scrollbar
318	// Source: https://github.com/idiotWu/smooth-scrollbar/
319	// =======================================================================================
320
321	if ($("body").hasClass("tt-smooth-scroll")) {
322
323		// Not for mobile devices!
324		if(!isMobile) {
325			
326			var Scrollbar = window.Scrollbar;
327
328			// AnchorPlugin (URL with hash links load in the right position)
329			// https://github.com/idiotWu/smooth-scrollbar/issues/440
330			// ==================================
331			class AnchorPlugin extends Scrollbar.ScrollbarPlugin {
332				static pluginName = 'anchor';
333
334				onHashChange = () => {
335					this.jumpToHash(window.location.hash);
336				};
337
338				onClick = (event) => {
339					const { target } = event;
340					if (target.tagName !== 'A') {
341						return;
342					}
343					const hash = target.getAttribute('href');
344					if (!hash || hash.charAt(0) !== '#') {
345						return;
346					}
347					this.jumpToHash(hash);
348				};
349
350				jumpToHash = (hash) => {
351					if (!hash) {
352						return;
353					}
354					const { scrollbar } = this;
355					scrollbar.containerEl.scrollTop = 0;
356					const target = document.querySelector(hash);
357					if (target) {
358						scrollbar.scrollIntoView(target, {
359							offsetTop: parseFloat(target.getAttribute('data-offset')) || 0 // Change to set default offset
360				   	});
361					}
362				};
363
364				onInit() {
365					this.jumpToHash(window.location.hash);
366					window.addEventListener('hashchange', this.onHashChange);
367					this.scrollbar.contentEl.addEventListener('click', this.onClick);
368				};
369
370				onDestory() {
371					window.removeEventListener('hashchange', this.onHashChange);
372					this.scrollbar.contentEl.removeEventListener('click', this.onClick);
373				};
374			};
375
376			// usage
377			Scrollbar.use(AnchorPlugin);
378
379
380			// Init Smooth Scrollbar
381			// ======================
382			Scrollbar.init(document.querySelector("#scroll-container"), {
383				damping: 0.05,
384				renderByPixel: true,
385				continuousScrolling: true,
386				alwaysShowTracks: true
387			});
388
389
390			// 3rd party library setup
391			// More info: https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.scrollerProxy()
392			// ========================
393			let scrollPositionX = 0,
394				scrollPositionY = 0,
395				bodyScrollBar = Scrollbar.init(document.getElementById("scroll-container"));
396
397			bodyScrollBar.addListener(({ offset }) => {  
398				scrollPositionX = offset.x;
399				scrollPositionY = offset.y;
400			});
401
402			bodyScrollBar.setPosition(0, 0);
403			bodyScrollBar.track.xAxis.element.remove();
404
405			// tell ScrollTrigger to use these proxy getter/setter methods for the "body" element:
406			ScrollTrigger.scrollerProxy("body", {
407				scrollTop(value) {
408					if (arguments.length) {
409						bodyScrollBar.scrollTop = value;
410					}
411					return bodyScrollBar.scrollTop;
412				}
413			});
414
415			// when smooth scroller updates, tell ScrollTrigger to update() too. 
416			bodyScrollBar.addListener(ScrollTrigger.update);
417
418
419			// Move "tt-header" out of "scroll-container"
420			// Expl: Since Smooth Scrollbar doesn't support element fixed position inside "scroll-container" move the "tt-header" out of it.
421			// ==========================================
422			if ($("#tt-header").hasClass("tt-header-fixed")) {
423				$("#scroll-container").before( $("#tt-header"));
424			}
425
426		}
427
428	}
429
430
431
432	// ==================================================
433	// Image lazy loading
434	// ==================================================
435
436	ScrollTrigger.config({ limitCallbacks: true });
437
438	gsap.utils.toArray(".tt-lazy").forEach(image => {
439		
440		let newSRC = image.dataset.src,
441			 newImage = document.createElement("img"),
442
443		loadImage = () => {
444			newImage.onload = () => {
445				newImage.onload = null; // avoid recursion
446				newImage.src = image.src; // swap the src
447				image.src = newSRC;
448				// place the low-res version on TOP and then fade it out.
449				gsap.set(newImage, {
450					position: "absolute", 
451					top: image.offsetTop, 
452					left: image.offsetLeft, 
453					width: image.offsetWidth, 
454					height: image.offsetHeight
455				});
456				image.parentNode.appendChild(newImage);
457				gsap.to(newImage, {
458					opacity: 0, 
459					onComplete: () => {
460						newImage.parentNode.removeChild(newImage);
461						image.removeAttribute("data-src"); // remove "data-src" attribute if image is loaded
462					}
463				});
464				st && st.kill();
465			}
466			newImage.src = newSRC;
467
468			ScrollTrigger.refresh(true);
469		}, 
470
471		st = ScrollTrigger.create({
472			trigger: image,
473			start: "-50% bottom",
474			onEnter: loadImage,
475			onEnterBack: loadImage // make sure it works in either direction
476		});
477	});
478
479
480
481	// ==================================================
482	// Main menu (classic)
483	// ==================================================
484
485	// Keeping sub-menus inside screen (useful if multi level sub-menus are used). Effect on large screens only!
486	// More info: http://stackoverflow.com/questions/17985334/jquery-solution-for-keeping-dropdown-dropdown-inside-screen
487	if ($(window).width() > 1024) {
488		$(".tt-submenu-trigger").parent().on("mouseenter", function() {
489			var menu = $("> .tt-submenu", this);
490			var menupos = $(menu).offset();
491
492			if (menupos.left + menu.width() > $(window).width()) {
493				var newpos = -$(menu).width();
494
495				menu.css({ left: newpos });    
496			}
497		});
498	}
499
500	// Main menu hover
501	$(".tt-main-menu-list").on("mouseenter", function() {
502		$(this).addClass("tt-mm-hover");
503	}).on("mouseleave", function() {
504		$(this).removeClass("tt-mm-hover");
505	});
506
507	// Submenu wrap hover
508	$(".tt-submenu-wrap").on("mouseenter", function() {
509		$(this).addClass("tt-submenu-open");
510	}).on("mouseleave", function() {
511		$(this).removeClass("tt-submenu-open");
512	});
513
514
515	// Mobile menu (for classic menu)
516	// ===============================
517
518	// Open/close mobile menu on toggle button click
519	$("#tt-m-menu-toggle-btn-wrap").on("click", function() {
520		$("html").toggleClass("tt-no-scroll");
521		$("body").toggleClass("tt-m-menu-open").addClass("tt-m-menu-active");
522		if ($("body").hasClass("tt-m-menu-open")) {
523
524			// Menu step in animations
525			$("body").addClass("tt-m-menu-toggle-no-click"); // Disable toggle button click until the animations last.
526
527			// Menu in animations
528			var tl_MenuIn = gsap.timeline({
529				onComplete: function() { 
530					$("body").removeClass("tt-m-menu-toggle-no-click"); 
531				}
532			});
533
534				 tl_MenuIn.to(".tt-main-menu", { duration: 0.4, autoAlpha: 1 });
535				 tl_MenuIn.from(".tt-main-menu-content > ul > li", { duration: 0.4, y: 80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeOut, clearProps:"all" });
536
537			// On menu link click
538			$(".tt-main-menu a, .tt-logo a")
539			.not('[target="_blank"]') // omit from selection
540			.not('[href="#"]') // omit from selection
541			.not('[href^="mailto"]') // omit from selection
542			.not('[href^="tel"]') // omit from selection
543			.on('click', function() {
544				$("body").addClass("tt-m-menu-toggle-no-click");
545
546				gsap.set("#content-wrap", { autoAlpha: 0 });
547				gsap.to(".tt-main-menu-content > ul > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
548
549				gsap.set("#content-wrap, .ttgr-cat-nav", { autoAlpha: 0 }); // Hide before timeline
550				var tl_MenuClick = gsap.timeline({
551					onComplete: function() { 
552						$(".tt-submenu").slideUp(350);
553						$(".tt-submenu-trigger").removeClass("tt-m-submenu-open");
554						$("html").removeClass("tt-no-scroll");
555						$("body").removeClass("tt-m-menu-toggle-no-click"); 	
556					}
557				});
558
559					 tl_MenuClick.to(".tt-main-menu-list > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
560					 tl_MenuClick.to("#content-wrap, .ttgr-cat-nav", { duration: 0.4, autoAlpha: 1, clearProps:"all" });
561					 tl_MenuClick.to(".tt-main-menu", { duration: 0.4, autoAlpha: 0 });
562					 tl_MenuClick.set(".tt-main-menu-list > li", { clearProps:"all" }); // clearProps only
563
564					setTimeout(function () {
565						$("body").removeClass("tt-m-menu-open");	
566					}, 500);
567			});
568
569		} else {	
570
571			// Menu step out animations
572			$("body").addClass("tt-m-menu-toggle-no-click"); // Disable toggle button click until the animations last.
573
574			// Menu out animations
575			var tl_MenuOut = gsap.timeline({
576				onComplete: function() {  
577					$(".tt-submenu").slideUp(350);
578					$(".tt-submenu-trigger").removeClass("tt-m-submenu-open");
579					$("body").removeClass("tt-m-menu-active tt-m-menu-toggle-no-click");
580				}
581			});
582
583				 tl_MenuOut.to(".tt-main-menu-content > ul > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
584				 tl_MenuOut.to(".tt-main-menu", { duration: 0.4, autoAlpha: 0, clearProps:"all" }, "+=0.2");
585				 tl_MenuOut.set(".tt-main-menu-content > ul > li", { clearProps:"all" }); // clearProps only
586		}
587
588		return false;
589	});
590
591	// Append element if link href contains #
592 	$('.tt-submenu-trigger > a[href="#"]').parent(".tt-submenu-trigger").append('<span class="tt-submenu-trigger-m"></span>');
593
594	// Open submenu if link href contains #
595	if ($(".tt-submenu-trigger > a").is('[href="#"]')) {
596		$(".tt-submenu-trigger-m").on("click", function() {
597			var $this = $(this).parent();
598			if ($this.hasClass("tt-m-submenu-open")) {
599				$this.removeClass("tt-m-submenu-open");
600				$this.next().slideUp(350);
601			} else {
602				$this.parent().parent().find(".tt-submenu").prev().removeClass("tt-m-submenu-open");
603				$this.parent().parent().find(".tt-submenu").slideUp(350);
604				$this.toggleClass("tt-m-submenu-open");
605				$this.next().slideToggle(350);
606			}
607		});
608	}
609
610	// Open submenu on caret click
611	$(".tt-submenu-trigger").append('<span class="tt-m-caret"></span>');
612	$(".tt-m-caret").on("click", function() {
613		var $this = $(this).parent();
614		if ($this.hasClass("tt-m-submenu-open")) {
615			$this.removeClass("tt-m-submenu-open");
616			$this.next().slideUp(350);
617		} else {
618			$this.parent().parent().find(".tt-submenu").prev().removeClass("tt-m-submenu-open");
619			$this.parent().parent().find(".tt-submenu").slideUp(350);
620			$this.toggleClass("tt-m-submenu-open");
621			$this.next().slideToggle(350);
622		}
623	});
624
625
626
627	// ==================================================
628	// Overlay menu 
629	// ==================================================
630
631	// Add class "tt-header-fixed-on" to <body> if "tt-header-fixed" enabled.
632	if ($("#tt-header").hasClass("tt-header-fixed")) {
633		$("body").addClass("tt-header-fixed-on");
634	}
635
636	// On menu toggle button click
637	// ============================
638	var $olMenuToggleBtn = $(".tt-ol-menu-toggle-btn-text, .tt-ol-menu-toggle-btn");
639
640	$olMenuToggleBtn.on("click", function() {
641		$("html").toggleClass("tt-no-scroll");
642		$("body").toggleClass("tt-ol-menu-open").addClass("tt-ol-menu-active");
643		if ($("body").hasClass("tt-ol-menu-open")) {
644
645			// Menu step in animations
646			$("body").addClass("olm-toggle-no-click"); // Disable toggle button click until the animations last.
647
648			var tl_olMenuIn = gsap.timeline({
649				onComplete: function() { 
650					$("body").removeClass("olm-toggle-no-click"); 
651				}
652			});
653
654				 tl_olMenuIn.to(".tt-overlay-menu", { duration: 0.4, autoAlpha: 1 });
655				 tl_olMenuIn.from(".tt-ol-menu-list > li", { duration: 0.4, y: 80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeOut, clearProps:"all" });
656				 if ($(".tt-ol-menu-social").length) {
657				 	tl_olMenuIn.to(".tt-ol-menu-social", { duration: 0.4, autoAlpha: 1 }, "-=0.4");
658				 	tl_olMenuIn.from(".tt-ol-menu-social > li", { duration: 0.4, y: 80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeOut, clearProps:"all" }, "-=0.4");
659				 }
660				 if ($(".tt-ol-menu-ghost").length) {
661				 	tl_olMenuIn.from(".tt-ol-menu-ghost", { duration: 0.4, y: 80, autoAlpha: 0, ease: Power2.easeOut, clearProps:"all" }, "-=0.4");
662				 }
663
664			// On menu link click
665			$(".tt-overlay-menu a, .tt-logo a")
666			.not('[target="_blank"]') // omit from selection
667			.not('[href="#"]') // omit from selection
668			.not('[href^="mailto"]') // omit from selection
669			.not('[href^="tel"]') // omit from selection
670			.on('click', function() {
671				$("body").addClass("olm-toggle-no-click");
672
673				gsap.set("#content-wrap, .ttgr-cat-nav", { autoAlpha: 0 }); // Hide before timeline
674				var tl_olMenuClick = gsap.timeline({
675					onComplete: function() { 
676						$(".tt-ol-submenu").slideUp(350);
677						$(".tt-ol-submenu-trigger").removeClass("tt-ol-submenu-open");
678						$("html").removeClass("tt-no-scroll");
679						$("body").removeClass("tt-ol-menu-active olm-toggle-no-click");
680					}
681				});
682
683					 tl_olMenuClick.to(".tt-ol-menu-list > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
684					 if ($(".tt-ol-menu-social").length) {
685					 	tl_olMenuClick.to(".tt-ol-menu-social > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn }, "-=0.4");
686					 	tl_olMenuClick.to(".tt-ol-menu-social", { duration: 0.4, autoAlpha: 0 }, "-=0.4");
687					 }
688					 if ($(".tt-ol-menu-ghost").length) {
689					 	tl_olMenuClick.to(".tt-ol-menu-ghost", { duration: 0.4, y: -40, autoAlpha: 0, ease:Power2.easeIn }, "-=0.4");
690					 }
691
692					 tl_olMenuClick.to("#content-wrap, .ttgr
692-cat-nav", { duration: 0.4, autoAlpha: 1, clearProps:"all" });
693					 tl_olMenuClick.to(".tt-overlay-menu", { duration: 0.4, autoAlpha: 0 });
694					 tl_olMenuClick.set(".tt-ol-menu-list > li, .tt-ol-menu-social > li, .tt-ol-menu-ghost", { clearProps:"all" }); // clearProps only
695
696					setTimeout(function () {
697						$("body").removeClass("tt-ol-menu-open");
698					}, 500);
699			});
700
701			// Hide sliding sidebar
702			if ($(".tt-sliding-sidebar-wrap").length) {
703				gsap.to(".tt-sliding-sidebar-trigger", { duration: 1, autoAlpha: 0, ease: Expo.easeOut });
704			}
705
706
707			// Move "tt-header" out of "scroll-container" (if Smooth Scroll is enabled and "tt-header-fixed" is NOT enabled)
708			// Expl: Since Smooth Scrollbar doesn't support element fixed position inside "scroll-container" move the "tt-header" out of it
709			if ($("body").hasClass("tt-smooth-scroll")) {
710				if (!$("#tt-header").hasClass("tt-header-fixed")) {
711					$("#scroll-container").before($("#tt-header"));
712				}
713			}
714
715			// Move "tt-ol-menu-social" out of "tt-header"
716			// Expl: Due to the conflict with fixed position and ancestor transitions
717			if ($(".tt-ol-menu-social").length) {
718				function ttOlMenuSocialResize() {
719					if (window.matchMedia("(min-width: 768px)").matches) {
720						$("#tt-header").before($(".tt-ol-menu-social"));
721					} else {
722						$(".tt-ol-menu-list").after($(".tt-ol-menu-social"));
723					}
724				};
725				ttOlMenuSocialResize();
726
727				$(window).resize(function() {
728					ttOlMenuSocialResize();
729				});
730			}
731
732		} else {	
733
734			// Menu step out animations
735			$("body").addClass("olm-toggle-no-click"); // Disable toggle button click until the animations last.
736
737			var tl_olMenuOut = gsap.timeline({
738				onComplete: function() { 
739					$(".tt-ol-submenu").slideUp(350);
740					$(".tt-ol-submenu-trigger").removeClass("tt-ol-submenu-open");
741					$("body").removeClass("tt-ol-menu-open tt-ol-menu-active olm-toggle-no-click");
742
743					// Move "tt-header" back to the "scroll-container" (if Smooth Scroll is enabled and "tt-header-fixed" is NOT enabled)
744					if ($("body").hasClass("tt-smooth-scroll")) {
745						if (!$("#tt-header").hasClass("tt-header-fixed")) {
746							$("#content-wrap").before($("#tt-header"));
747						}
748					}
749
750					// Move "tt-ol-menu-social" back to the "tt-overlay-menu"
751					if ($(".tt-ol-menu-social").length) {
752						$(".tt-ol-menu-list").after($(".tt-ol-menu-social"));
753					}
754				}
755			});
756				 tl_olMenuOut.to(".tt-ol-menu-list > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
757				 if ($(".tt-ol-menu-social").length) {
758				 	tl_olMenuOut.to(".tt-ol-menu-social > li", { duration: 0.4, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn }, "-=0.4");
759				 	tl_olMenuOut.to(".tt-ol-menu-social", { duration: 0.4, autoAlpha: 0, clearProps:"all" }, "-=0.4");
760				 }
761				 if ($(".tt-ol-menu-ghost").length) {
762				 	tl_olMenuOut.to(".tt-ol-menu-ghost", { duration: 0.4, y: -60, autoAlpha: 0, ease:Power2.easeIn }, "-=0.4");
763				 }
764				 tl_olMenuOut.to(".tt-overlay-menu", { duration: 0.4, autoAlpha: 0, clearProps:"all" }, "+=0.2");
765				 tl_olMenuOut.set(".tt-ol-menu-list > li, .tt-ol-menu-social > li, .tt-ol-menu-ghost", { clearProps:"all" }); // clearProps only
766
767			// Show sliding sidebar
768			if ($(".tt-sliding-sidebar-wrap").length) {
769				gsap.to(".tt-sliding-sidebar-trigger", { duration: 1, autoAlpha: 1, ease: Expo.easeOut, clearProps:"all" }, "-=0.3");
770			}
771		}
772		
773		return false;
774	});
775
776	// Menu list hover
777	$(".tt-ol-menu-list").on("mouseenter", function() {
778		$(this).addClass("tt-ol-menu-hover");
779	}).on("mouseleave", function() {
780		$(this).removeClass("tt-ol-menu-hover");
781	});
782
783	// Open submenu if link href contains #
784	$(".tt-ol-submenu-trigger > a").on("click", function() {
785		if ($(this).is('[href="#"]')) {
786			var $this = $(this).parent();
787			if ($this.hasClass("tt-ol-submenu-open")) {
788				$this.removeClass("tt-ol-submenu-open");
789				$this.next().slideUp(350);
790			} else {
791				$this.parent().parent().find(".tt-ol-submenu").prev().removeClass("tt-ol-submenu-open");
792				$this.parent().parent().find(".tt-ol-submenu").slideUp(350);
793				$this.toggleClass("tt-ol-submenu-open");
794				$this.next().slideToggle(350);
795			}
796		}
797		return false;
798	});
799
800	// Open submenu on caret click
801	$(".tt-ol-submenu-caret-wrap").on("click", function() {
802		var $this = $(this).parent();
803		if ($this.hasClass("tt-ol-submenu-open")) {
804			$this.removeClass("tt-ol-submenu-open");
805			$this.next().slideUp(350);
806		} else {
807			$this.parent().parent().find(".tt-ol-submenu").prev().removeClass("tt-ol-submenu-open");
808			$this.parent().parent().find(".tt-ol-submenu").slideUp(350);
809			$this.toggleClass("tt-ol-submenu-open");
810			$this.next().slideToggle(350);
811		}
812	});
813
814
815
816	// =======================================================================================
817	// Portfolio slider (full screen)
818	// Source: https://swiperjs.com/
819	// =======================================================================================
820
821	if ($(".tt-portfolio-slider-off").length) {
822		$("body").addClass("tt-portfolio-slider-on");
823
824		$(".tt-portfolio-slider-off").each(function() {
825			var $ttPortfolioSlider = $(this);
826
827			// Data attributes
828			// ================
829			var $dataMousewheel = $ttPortfolioSlider.data("mousewheel");
830			var $dataKeyboard = $ttPortfolioSlider.data("keyboard");
831			var $dataSimulateTouch = $ttPortfolioSlider.data("simulate-touch");
832			var $dataGrabCursor = $ttPortfolioSlider.data("grab-cursor");
833			var $dataAutoplay = $ttPortfolioSlider.data("autoplay") ? { delay: $ttPortfolioSlider.data("autoplay"),}
833 : $ttPortfolioSlider.data("autoplay");
834			var $dataLoop = $ttPortfolioSlider.data("loop") ? { loopedSlides: 100, } : $ttPortfolioSlider.data("loop"); // Not recommended!
835
836			if ($ttPortfolioSlider.is("[data-speed]")) {
837				var $dataSpeed = $ttPortfolioSlider.data("speed");
838			} else {
839				var $dataSpeed = 900; // by default
840			}
841
842			if ($ttPortfolioSlider.is("[data-pagination-type]")) {
843				var $dataPaginationType = $ttPortfolioSlider.data("pagination-type");
844			} else {
845				var $dataPaginationType = "fraction"; // by default (bullets/fraction/progressbar)
846			}
847
848			// Init Swiper
849			// =============
850			var $ttPortfolioSliderSwiper = new Swiper ($ttPortfolioSlider.find(".swiper")[0], {
851				// Parameters
852				direction: "horizontal",
853				effect: "slide",
854				speed: 600, // slider speed for smaller screens (when window width is 1024px or smaller)
855				parallax: true,
856				resistanceRatio: 0,
857				longSwipesRatio: 0.02,
858				preloadImages: false, // Needed for lazy loading
859				preventInteractionOnTransition: true, // No actions during transition
860				autoplay: $dataAutoplay,
861				mousewheel: $dataMousewheel,
862				keyboard: $dataKeyboard,
863				simulateTouch: $dataSimulateTouch,
864				grabCursor: $dataGrabCursor,
865				loop: $dataLoop, // Not recommended!
866
867				lazy: {
868					loadPrevNext: true,
869					loadOnTransitionStart: true,
870				},
871
872				breakpoints: {
873					// when window width is 1025px or larger
874					1025: {
875						speed: $dataSpeed,
876					}
877				},
878
879				// Navigation arrows
880				navigation: {
881					nextEl: $ttPortfolioSlider.find(".tt-ps-nav-arrow-next")[0],
882					prevEl: $ttPortfolioSlider.find(".tt-ps-nav-arrow-prev")[0],
883					disabledClass: "tt-ps-nav-arrow-disabled",
884				},
885
886				// Pagination
887				pagination: {
888					el: $ttPortfolioSlider.find(".tt-ps-nav-pagination")[0],
889					type: $dataPaginationType,
890					modifierClass: "tt-ps-nav-pagination-",
891					dynamicBullets: true,
892					dynamicMainBullets: 1,
893					clickable: true,
894				},
895
896				// Events
897				on: {
898					init: function () {
899
900						var $this = this;
901						var $slideActive = $($this.slides[$this.activeIndex]);
902
903						// Play video on load
904						$slideActive.find("video").each(function() {
905							$(this).get(0).play();
906						}); 
907
908						// Portfolio slider caption on load
909						// ---------------------------------
910						// Portfolio slider caption title (contains link or not)
911						if ($ttPortfolioSlider.find(".tt-ps-caption-title").find("a").length) {
912							$ttPortfolioSlider.find(".tt-ps-caption-title a").html($slideActive.attr("data-title"));
913							$ttPortfolioSlider.find(".tt-ps-caption-title a").attr("href", $slideActive.attr("data-url"));
914						} else {
915							$ttPortfolioSlider.find(".tt-ps-caption-title").html($slideActive.attr("data-title"));
916						}
917
918						// Portfolio slider caption category on load
919						$ttPortfolioSlider.find(".tt-ps-caption-category").text($slideActive.attr("data-category"));
920
921						// If slider image is light on load
922						setTimeout(function(){
923							if ($slideActive.hasClass("psi-image-is-light")) {
924								$("body").addClass("tt-light-bg-on psi-light-bg-on");
925							} else {
926								$("body").removeClass("tt-light-bg-on psi-light-bg-on");
927							}
928						}, 400);
929
930					},
931
932					transitionStart: function () {
933
934						var $this = this;
935						var $slideActive = $($this.slides[$this.activeIndex]);
936
937						// If slider image is light
938						setTimeout(function(){
939							if ($slideActive.hasClass("psi-image-is-light")) {
940								$("body").addClass("tt-light-bg-on psi-light-bg-on");
941							} else {
942								$("body").removeClass("tt-light-bg-on psi-light-bg-on");
943							}
944						}, 400);
945
946						// Play video
947						$slideActive.find("video").each(function() {
948							$(this).get(0).play();
949						}); 
950					},
951
952					transitionEnd: function () {
953
954						var $this = this;
955						var $slideActive = $($this.slides[$this.activeIndex]);
956
957						// Pause video
958						$slideActive.prevAll().find("video").each(function() {
959							$(this).get(0).pause();
960						});
961						$slideActive.nextAll().find("video").each(function() {
962							$(this).get(0).pause();
963						});
964
965						// Portfolio slider caption
966						// -------------------------
967						// Portfolio slider caption title (if contains link or not)
968						if ($ttPortfolioSlider.find(".tt-ps-caption-title").find("a").length) {
969							$ttPortfolioSlider.find(".tt-ps-caption-title a").html($slideActive.attr("data-title"));
970							$ttPortfolioSlider.find(".tt-ps-caption-title a").attr("href", $slideActive.attr("data-url"));
971						} else {
972							$ttPortfolioSlider.find(".tt-ps-caption-title").html($slideActive.attr("data-title"));
973						}
974
975						// Portfolio slider caption category
976						$ttPortfolioSlider.find(".tt-ps-caption-category").text($slideActive.attr("data-category"));
977					},
978
979
980					slideNextTransitionStart: function () {
981						// Animate portfolio slider caption
982						gsap.fromTo($ttPortfolioSlider.find(".tt-psc-elem"), { autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "right" }, { duration: 0.25, autoAlpha: 0, x: -40, scaleX: 1.1, transformOrigin: "right", stagger: 0.15, ease: Power1.easeIn });
983					},
984
985					slideNextTransitionEnd: function () {
986						// Animate portfolio slider caption
987						gsap.fromTo($ttPortfolioSlider.find(".tt-psc-elem"), { autoAlpha: 0, x: 40, scaleX: 1.1, transformOrigin: "left" }, { duration: 0.25, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", stagger: 0.15, ease: Power1.easeOut, clearProps: "all" });
988					},
989
990
991					slidePrevTransitionStart: function () {
992						// Animate portfolio slider caption
993						gsap.fromTo($ttPortfolioSlider.find(".tt-psc-elem"), { autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left" }, { duration: 0.25, autoAlpha: 0, x: 40, scaleX: 1.1, transformOrigin: "left", stagger: 0.15, ease: Power1.easeIn });
994					},
995
996					slidePrevTransitionEnd: function () {
997						// Animate portfolio slider caption
998						gsap.fromTo($ttPortfolioSlider.find(".tt-psc-elem"), { autoAlpha: 0, x: -40, scaleX: 1.1, transformOrigin: "right" }, { duration: 0.25, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "right", stagger: 0.15, ease: Power1.easeOut, clearProps: "all" });
999					}
1000				}
1001			});
1002
1003
1004			// Parallax effect on mouse move (no effect on mobile devices!)
1005			// ------------------------------
1006			if(!isMobile) {
1007				if ($ttPortfolioSlider.data("parallax-mouse-move")) {
1008					gsap.set($ttPortfolioSlider.find(".tt-psi-image"), { scale: 1.05 });
1009
1010					$ttPortfolioSlider.mousemove(function(e) {
1011						parallaxIt(e, $ttPortfolioSlider.find(".tt-psi-image"), -25); // Parallax element
1012						parallaxIt(e, $ttPortfolioSlider.find(".tt-ps-caption-inner"), -35); // Parallax element
1013					});
1014
1015					function parallaxIt(e, target, movement) {
1016						var $this = $ttPortfolioSlider
1017						var relX = e.pageX - $this.offset().left;
1018						var relY = e.pageY - $this.offset().top;
1019
1020						gsap.to(target, {
1021							duration: 1,
1022							x: (relX - $this.width() / 2) / $this.width() * movement,
1023							y: (relY - $this.height() / 2) / $this.height() * movement
1024						});
1025					}
1026				}
1027			}
1028
1029		});
1030	}
1031
1032
1033
1034	// =======================================================================================
1035	// Portfolio carousel (full screen carousel)
1036	// Source: https://swiperjs.com/
1037	// =======================================================================================
1038
1039	if ($(".tt-portfolio-carousel-off").length) {
1040		$(".tt-portfolio-carousel-off").each(function() {
1041			var $ttPortfolioCarousel = $(this);
1042
1043			// Data attributes
1044			// ================
1045			var $dataMousewheel = $ttPortfolioCarousel.data("mousewheel");
1046			var $dataKeyboard = $ttPortfolioCarousel.data("keyboard");
1047			var $dataSimulateTouch = $ttPortfolioCarousel.data("simulate-touch");
1048			var $dataGrabCursor = $ttPortfolioCarousel.data("grab-cursor");
1049			var $dataAutoplay = $ttPortfolioCarousel.data("autoplay") ? { delay: $ttPortfolioCarousel.data("autoplay"),} : $ttPortfolioCarousel.data("autoplay");
1050			var $dataLoop = $ttPortfolioCarousel.data("loop") ? { loopedSlides: 100, } : $ttPortfolioCarousel.data("loop"); // Not recommended!
1051
1052			if ($ttPortfolioCarousel.is("[data-speed]")) {
1053				var $dataSpeed = $ttPortfolioCarousel.data("speed"); // speed for larger screens
1054			} else {
1055				var $dataSpeed = 1200; // speed for larger screens (by default) 
1056			}
1057
1058			if ($ttPortfolioCarousel.is("[data-pagination-type]")) {
1059				var $dataPaginationType = $ttPortfolioCarousel.data("pagination-type");
1060			} else {
1061				var $dataPaginationType = "fraction"; // by default (bullets/fraction/progressbar)
1062			}
1063
1064			// Init Swiper
1065			// =============
1066			var $ttPortfolioCarouselSwiper = new Swiper ($ttPortfolioCarousel.find(".swiper")[0], {
1067				// Parameters
1068				direction: "horizontal",
1069				slidesPerView: "auto",
1070				spaceBetween: 0,
1071				resistanceRatio: 0.85,
1072				longSwipesRatio: 0.3,
1073				shortSwipes: true,
1074				centeredSlides: true,
1075				preloadImages: false, // Needed for lazy loading
1076				watchSlidesProgress: true, // Needed for lazy loading (if slidesPerView is "auto" or more than 1)
1077				preventInteractionOnTransition: false, // No actions during transition
1078				speed: 900, // Slider speed for smaller screens (when window width is 1024px or smaller)
1079				keyboard: $dataKeyboard,
1080				mousewheel: $dataMousewheel,
1081				autoplay: $dataAutoplay,
1082				simulateTouch: $dataSimulateTouch,
1083				grabCursor: $dataGrabCursor,
1084				loop: $dataLoop, // Not recommended!
1085
1086				lazy: {
1087					loadPrevNext: true,
1088					loadOnTransitionStart: true,
1089				},
1090
1091				breakpoints: {
1092					// When window width is 1025px or larger
1093					1025: {
1094						speed: $dataSpeed,
1095					}
1096				},
1097
1098				// Navigation arrows
1099				navigation: {
1100					nextEl: $ttPortfolioCarousel.find(".tt-pc-arrow-next")[0],
1101					prevEl: $ttPortfolioCarousel.find(".tt-pc-arrow-prev")[0],
1102					disabledClass: "tt-pc-arrow-disabled",
1103				},
1104
1105				// Pagination
1106				pagination: {
1107					el: $ttPortfolioCarousel.find(".tt-pc-pagination")[0],
1108					type: $dataPaginationType,
1109					modifierClass: "tt-pc-pagination-",
1110					dynamicBullets: true,
1111					dynamicMainBullets: 1,
1112					clickable: true,
1113				},
1114
1115				// Events
1116				on: {
1117					lazyImageReady: (swiper) => { // Lazy load + slidesPerView:"auto" fix.
1118						$ttPortfolioCarouselSwiper.update()
1119					},
1120
1121					init: function () {
1122
1123						var $this = this;
1124						var $slideActive = $($this.slides[$this.activeIndex]);
1125
1126						// Active slide class (custom) on load
1127						$slideActive.addClass("tt-slide-active"); // Add class to active slide.
1128
1129						// Carousel slide disabled (prev/next slide) on load
1130						$slideActive.prevAll().addClass("tt-pcs-disabled");
1131						$slideActive.nextAll().addClass("tt-pcs-disabled");
1132
1133					},
1134
1135					transitionStart: function () {
1136
1137						var $this = this;
1138						var $slideActive = $($this.slides[$this.activeIndex]);
1139
1140						// Active slide classes (custom).
1141						$slideActive.addClass("tt-slide-active"); // Add class to active slide.
1142						$slideActive.prev().addClass("tt-slide-active-start"); // Add class if active slide transition starts.
1143						$slideActive.next().addClass("tt-slide-active-start"); // Add class if active slide transition starts.
1144
1145						// Carousel slide disabled (prev/next slide)
1146						$slideActive.prevAll().addClass("tt-pcs-disabled");
1147						$slideActive.removeClass("tt-pcs-disabled");
1148						$slideActive.nextAll().addClass("tt-pcs-disabled");
1149
1150						// Play video
1151						$(".swiper-slide-active").find("video").each(function() {
1152							$(this).get(0).play();
1153						}); 
1154
1155						// Disable nav arrow action.
1156						$(".tt-pc-arrow").addClass("tt-pc-arrow-disabled");
1157
1158					},
1159
1160					transitionEnd: function () {
1161
1162						var $this = this;
1163						var $slideActive = $($this.slides[$this.activeIndex]);
1164
1165						// Active slide classes (custom)
1166						$slideActive.prevAll().removeClass("tt-slide-active"); // Remove class if active slide transition ends.
1167						$slideActive.nextAll().removeClass("tt-slide-active"); // Remove class if active slide transition ends.
1168						$slideActive.prev().removeClass("tt-slide-active-start"); // Remove class if active slide transition ends.
1169						$slideActive.next().removeClass("tt-slide-active-start"); // Remove class if active slide transition ends.
1170
1171						// Pause video
1172						$(".swiper-slide-prev").find("video").each(function() {
1173							$(this).get(0).pause();
1174						});
1175						
1176						$(".swiper-slide-next").find("video").each(function() {
1177							$(this).get(0).pause();
1178						});
1179
1180						// Disable nav arrow action.
1181						$(".tt-pc-arrow").removeClass("tt-pc-arrow-disabled");
1182
1183					}
1184				}
1185			});
1186
1187			// Scale down animation on carousel click
1188			if ($ttPortfolioCarousel.attr("data-simulate-touch") == "true") {
1189				if ($ttPortfolioCarousel.hasClass("pc-scale-down")) {
1190					$ttPortfolioCarousel.find(".swiper").on("mousedown touchstart pointerdown", function(e) {
1191						if (e.which === 1) { // Affects the left mouse button only!
1192							gsap.to($ttPortfolioCarousel.find(".tt-pci-inner"), { duration: 0.7, scale: 0.9 });
1193						}
1194					});
1195					$("body").on("mouseup touchend pointerup mouseleave", function() {	
1196						gsap.to($ttPortfolioCarousel.find(".tt-pci-inner"), { duration: 0.7, scale: 1, clearProps: "scale" });
1197					});
1198				}
1199			}
1200
1201			// Update slider when windows resize or orientation change 
1202			$(window).on("resize orientationchange", function() {
1203				setTimeout(function(){
1204					$ttPortfolioCarouselSwiper.update();
1205					$ttPortfolioCarousel.find(".swiper-wrapper").addClass("swtr-smooth");
1206				}, $dataSpeed);
1207
1208				setTimeout(function(){
1209					$ttPortfolioCarousel.find(".swiper-wrapper").removeClass("swtr-smooth");
1210				}, $dataSpeed + $dataSpeed);
1211			});
1212		});
1213	}
1214
1215
1216
1217	// =======================================================================================
1218	// Portfolio hover carousel (full screen carousel)
1219	// Source: https://swiperjs.com/
1220	// =======================================================================================
1221
1222	if ($(".tt-portfolio-hover-carousel").length) {
1223		$("body").addClass("tt-portfolio-hover-carousel-on");
1224
1225		$(".tt-portfolio-hover-carousel").each(function() {
1226			var $ttPortfolioHoverCarousel = $(this);
1227
1228			// Data attributes
1229			// ================
1230			var $dataSimulateTouch = $ttPortfolioHoverCarousel.data("simulate-touch");
1231			var $dataGrabCursor = $ttPortfolioHoverCarousel.data("grab-cursor");
1232			var $dataLoop = $ttPortfolioHoverCarousel.data("loop") ? { loopedSlides: 100, } : $ttPortfolioHoverCarousel.data("loop");
1233
1234
1235			// Init Swiper
1236			// =============
1237			var $ttPortfolioHoverCarouselSwiper = new Swiper ($ttPortfolioHoverCarousel.find(".swiper")[0], {
1238				// Parameters
1239				direction: "horizontal",
1240				slidesPerView: "auto",
1241				spaceBetween: 0,
1242				shortSwipes: true,
1243				speed: 900, 
1244				keyboard: false,
1245				mousewheel: true,
1246				watchSlidesProgress: true,
1247				simulateTouch: $dataSimulateTouch,
1248				grabCursor: $dataGrabCursor,
1249				loop: $dataLoop,
1250
1251				// Events
1252				on: {
1253
1254					init: function () {
1255
1256						// Fix position issue on load.
1257						setTimeout(function(){
1258							$ttPortfolioHoverCarouselSwiper.update();
1259						}, 100);
1260
1261
1262						// Carousel item hover
1263						// ====================
1264
1265						// First image
1266						var $phcFirstImage = $(".phc-image").first();
1267						$phcFirstImage.addClass("active");
1268						$phcFirstImage.find("video").each(function() {
1269							$(this).get(0).play();
1270						});
1271
1272						// First slide
1273						var $phcFirstSlide = $(".tt-portfolio-hover-carousel").find(".swiper-slide").not(".swiper-slide-duplicate").first();
1274						$phcFirstSlide.addClass("active");
1275						
1276						// If first slide image is light
1277						if ($phcFirstSlide.hasClass("active")) {
1278							if ($phcFirstImage.hasClass("phc-image-is-light")) {
1279								$("body").addClass("tt-light-bg-on");
1280							} else {
1281								$("body").removeClass("tt-light-bg-on");
1282							}
1283						}
1284
1285						// Mouse hover
1286						$ttPortfolioHoverCarousel.find(".swiper-slide").on("mouseenter touchstart", function() {
1287							if (!$(this).hasClass("active")) {
1288								$('.phc-image').find('video').each(function() {
1289									$(this).get(0).pause();
1290								});
1291								$(this).addClass("active").siblings().removeClass("active");
1292								var $phcSlide = $(this).data("slide");
1293								var $phcImage = $('.phc-image[data-slide="' + $phcSlide + '"]');
1294								$ttPortfolioHoverCarousel.find(".phc-image").removeClass("active");
1295								$phcImage.addClass("active");
1296								$phcImage.find('video').each(function() {
1297									$(this).get(0).play();
1298								});
1299
1300								// If image is light
1301								if ($(this).parents($ttPortfolioHoverCarousel).find($phcImage).hasClass("phc-image-is-light")) {
1302									$("body").addClass("tt-light-bg-on");
1303								} else {
1304									$("body").removeClass("tt-light-bg-on");
1305								}
1306
1307								// Slides count
1308								var $phcCounter = $('.tt-phc-count span[data-slide="' + $phcSlide + '"]');
1309								gsap.to(".tt-phc-count span", { duration: 0.1, autoAlpha: 0, ease: Power2.easeIn });
1310								gsap.to($phcCounter, { duration: 0.1, autoAlpha: 1, ease:Power2.easeOut });
1311							}
1312
1313						});
1314
1315						// Slides total count
1316						var $phcTotalCount = $ttPortfolioHoverCarousel.find(".swiper-slide").not(".swiper-slide-duplicate").length;
1317						$(".tt-phc-counter-separator").after('<span class="tt-phc-total">' + $phcTotalCount);
1318
1319					}
1320
1321				}
1322
1323			});
1324
1325		});
1326	}
1327
1328
1329
1330	// =======================================================================================
1331	// Blog carousel
1332	// Source: https://swiperjs.com/
1333	// =======================================================================================
1334
1335	if ($(".tt-blog-carousel-off").length) {
1336		$(".tt-blog-carousel-off").each(function() {
1337			var $ttBlogCarousel = $(this);
1338
1339			// Data attributes
1340			// ================
1341			var $dataSimulateTouch = $ttBlogCarousel.data("simulate-touch");
1342			var $autoplay = $ttBlogCarousel.data("autoplay") ? { delay: $ttBlogCarousel.data("autoplay"), } : $ttBlogCarousel.data("autoplay");
1343			var $dataLoop = $ttBlogCarousel.data("loop") ? { loopedSlides: 3, } : $ttBlogCarousel.data("loop");
1344
1345			if ($ttBlogCarousel.is("[data-speed]")) {
1346				var $dataSpeed = $ttBlogCarousel.data("speed");
1347			} else {
1348				var $dataSpeed = 900; // by default
1349			}
1350
1351			if ($ttBlogCarousel.is("[data-pagination-type]")) {
1352				var $dataPaginationType = $ttBlogCarousel.data("pagination-type");
1353			} else {
1354				var $dataPaginationType = "bullets"; // by default (bullets/fraction/progressbar)
1355			}
1356
1357			// Init Swiper
1358			// =============
1359			var $ttBlogCarouselSwiper = new Swiper($ttBlogCarousel.find(".swiper")[0], {
1360				// Parameters
1361				direction: "horizontal",
1362				slidesPerView: 1,
1363				spaceBetween: 30,
1364				longSwipesRatio: 0.3,
1365				mousewheel: false,
1366				keyboard: false,
1367				preloadImages: false, // Needed for lazy loading
1368				watchSlidesProgress: true, // Needed for lazy loading (if slidesPerView is "auto" or more than 1)
1369				preventInteractionOnTransition: false, // No actions during transition
1370				grabCursor: true,
1371				simulateTouch: $dataSimulateTouch,
1372				speed: $dataSpeed,
1373				autoplay: $autoplay,
1374				loop: $dataLoop,
1375
1376				lazy: {
1377					loadPrevNext: false,
1378					loadOnTransitionStart: true,
1379				},
1380
1381				breakpoints: {
1382					// when window width is 1025px or larger
1383					1025: {
1384						slidesPerView: 3,
1385						spaceBetween: 0,
1386					},
1387
1388					// when window width is 769px or larger
1389					769: {
1390						slidesPerView: 2,
1391						spaceBetween: 0,
1392					}
1393				},
1394
1395				// Navigation (arrows)
1396				navigation: {
1397					nextEl: $ttBlogCarousel.find(".tt-blc-nav-next")[0],
1398					prevEl: $ttBlogCarousel.find(".tt-blc-nav-prev")[0],
1399					disabledClass: "tt-blc-nav-arrow-disabled",
1400				},
1401
1402				// Pagination
1403				pagination: {
1404					el: $ttBlogCarousel.find(".tt-blc-pagination")[0],
1405					type: $dataPaginationType,
1406					modifierClass: "tt-blc-pagination-",
1407					dynamicBullets: true,
1408					dynamicMainBullets: 1,
1409					clickable: true,
1410				},
1411
1412				// Events
1413				on: {
1414					lazyImageReady: (swiper) => { // Lazy load + slidesPerView:"auto" fix.
1415						$ttBlogCarouselSwiper.update()
1416					}
1417				}
1418
1419			});
1420
1421		});
1422
1423	}
1424
1425
1426
1427	// =======================================================================================
1428	// Content carousel
1429	// Source: https://swiperjs.com/
1430	// =======================================================================================
1431
1432	if ($(".tt-content-carousel-off").length) {
1433		$(".tt-content-carousel-off").each(function() {
1434			var $ttContentCarousel = $(this);
1435
1436			// Data attributes
1437			// ================
1438			var $dataSimulateTouch = $ttContentCarousel.data("simulate-touch");
1439			var $autoplay = $ttContentCarousel.data("autoplay") ? { delay: $ttContentCarousel.data("autoplay"), } : $ttContentCarousel.data("autoplay");
1440			var $dataLoop = $ttContentCarousel.data("loop") ? { loopedSlides: 100, } : $ttContentCarousel.data("loop");
1441
1442			if ($ttContentCarousel.is("[data-speed]")) {
1443				var $dataSpeed = $ttContentCarousel.data("speed");
1444			} else {
1445				var $dataSpeed = 900; // by default
1446			}
1447
1448			if ($ttContentCarousel.is("[data-pagination-type]")) {
1449				var $dataPaginationType = $ttContentCarousel.data("pagination-type");
1450			} else {
1451				var $dataPaginationType = "bullets"; // by default (bullets/fraction/progressbar)
1452			}
1453
1454			// Init Swiper
1455			// =============
1456			var $ttContentCarouselSwiper = new Swiper($ttContentCarousel.find(".swiper")[0], {
1457				// Parameters
1458				direction: "horizontal",
1459				slidesPerView: "auto",
1460				spaceBetween: 0,
1461				centeredSlides: true,
1462				longSwipesRatio: 0.3,
1463				mousewheel: false,
1464				keyboard: false,
1465				preloadImages: false, // Needed for lazy loading
1466				watchSlidesProgress: true, // Needed for lazy loading (if slidesPerView is "auto" or more than 1)
1467				preventInteractionOnTransition: false, // No actions during transition
1468				simulateTouch: $dataSimulateTouch,
1469				grabCursor: $dataSimulateTouch,
1470				speed: $dataSpeed,
1471				autoplay: $autoplay,
1472				loop: $dataLoop,
1473				lazy: true,
1474
1475				// Navigation (arrows)
1476				navigation: {
1477					nextEl: $ttContentCarousel.find(".tt-cc-nav-next")[0],
1478					prevEl: $ttContentCarousel.find(".tt-cc-nav-prev")[0],
1479					disabledClass: "tt-cc-nav-arrow-disabled",
1480				},
1481
1482				// Pagination
1483				pagination: {
1484					el: $ttContentCarousel.find(".tt-cc-pagination")[0],
1485					type: $dataPaginationType,
1486					modifierClass: "tt-cc-pagination-",
1487					dynamicBullets: true,
1488					dynamicMainBullets: 1,
1489					clickable: true,
1490				},
1491
1492				// Events
1493				on: {
1494					lazyImageReady: (swiper) => { // Lazy load + slidesPerView:"auto" fix.
1495						$ttContentCarouselSwiper.update()
1496					},
1497
1498					transitionStart: function () {
1499
1500						// Play video
1501						$(".swiper-slide-active").find("video").each(function() {
1502							$(this).get(0).play();
1503						}); 
1504
1505					},
1506
1507					transitionEnd: function () {
1508
1509						// Pause video
1510						$(".swiper-slide-prev").find("video").each(function() {
1511							$(this).get(0).pause();
1512						});
1513						
1514						$(".swiper-slide-next").find("video").each(function() {
1515							$(this).get(0).pause();
1516						});
1517
1518					}
1519				}
1520			});
1521
1522			// Scale down animation on carousel click
1523			// =======================================
1524			if ($ttContentCarousel.attr("data-simulate-touch") == "true") {
1525				if ($ttContentCarousel.hasClass("cc-scale-down")) {
1526					$ttContentCarousel.find(".swiper-wrapper").on("mousedown touchstart pointerdown", function(e) {
1527						if (e.which === 1) { // Affects the left mouse button only!
1528							gsap.to($ttContentCarousel.find(".tt-content-carousel-item"), { duration: 0.7, scale: 0.9 });
1529						}
1530					});
1531					$("body").on("mouseup touchend pointerup mouseleave", function() {	
1532						gsap.to($ttContentCarousel.find(".tt-content-carousel-item"), { duration: 0.7, scale: 1, clearProps: "scale" });
1533					});
1534				}
1535			}
1536
1537		});
1538
1539	}
1540
1541
1542
1543	// =======================================================================================
1544	// Testimonials slider
1545	// Source: https://swiperjs.com/
1546	// =======================================================================================
1547
1548	if ($(".tt-testimonials-slider-off").length) {
1549		$(".tt-testimonials-slider-off").each(function() {
1550			var $ttTestimonialsSlider = $(this);
1551
1552			// Data attributes
1553			// ================
1554			var $dataSimulateTouch = $ttTestimonialsSlider.data("simulate-touch");
1555			var $autoplay = $ttTestimonialsSlider.data("autoplay") ? { delay: $ttTestimonialsSlider.data("autoplay"), } : $ttTestimonialsSlider.data("autoplay");
1556			var $dataLoop = $ttTestimonialsSlider.data("loop") ? { loopedSlides: 100, } : $ttTestimonialsSlider.data("loop");
1557
1558			if ($ttTestimonialsSlider.is("[data-speed]")) {
1559				var $dataSpeed = $ttTestimonialsSlider.data("speed");
1560			} else {
1561				var $dataSpeed = 900; // by default
1562			}
1563
1564			// Init Swiper
1565			// =============
1566			var $ttTestimonialsSliderSwiper = new Swiper ($ttTestimonialsSlider.find(".swiper")[0], {
1567				// Parameters
1568				direction: "horizontal",
1569				slidesPerView: "auto",
1570				spaceBetween: 0,
1571				mousewheel: false,
1572				longSwipesRatio: 0.3,
1573				grabCursor: true,
1574				autoHeight: true,
1575				centeredSlides: true,
1576				preventInteractionOnTransition: false, // No actions during transition
1577				speed: $dataSpeed,
1578				simulateTouch: $dataSimulateTouch,
1579				autoplay: $autoplay,
1580				loop: $dataLoop,
1581
1582				// Navigation (arrows)
1583				navigation: {
1584					nextEl: $ttTestimonialsSlider.find(".tt-ts-nav-next")[0],
1585					prevEl: $ttTestimonialsSlider.find(".tt-ts-nav-prev")[0],
1586					disabledClass: "tt-ts-nav-arrow-disabled",
1587				},
1588
1589				// Pagination
1590				pagination: {
1591					el: $ttTestimonialsSlider.find(".tt-ts-pagination")[0],
1592					type: "bullets",
1593					modifierClass: "tt-ts-pagination-",
1594					dynamicBullets: true,
1595					dynamicMainBullets: 1,
1596					clickable: true,
1597				}
1598			});
1599
1600			// Auto height fix
1601			setTimeout(function() {
1602				$ttTestimonialsSliderSwiper.updateAutoHeight();
1603			}, 100);
1604
1605			// Scale down animation on slider click
1606			if ($ttTestimonialsSlider.hasClass("ts-scale-down")) {
1607				$ttTestimonialsSlider.find(".swiper-wrapper").on("mousedown touchstart pointerdown", function(e) {
1608					if (e.which === 1) { // Affects the left mouse button only!
1609						gsap.to($ttTestimonialsSlider.find(".tt-ts-item-inner"), { duration: 0.7, scale: 0.9 });
1610					}
1611				});
1612				$("body").on("mouseup touchend pointerup", function() {	
1613					gsap.to($ttTestimonialsSlider.find(".tt-ts-item-inner"), { duration: 0.7, scale: 1, clearProps: "scale" });
1614				});
1615			}
1616		});
1617	}
1618
1619
1620
1621	// ============================================================================
1622   // Isotope
1623   // More info: http://isotope.metafizzy.co
1624   // Note: "imagesloaded" blugin is required! https://imagesloaded.desandro.com/
1625   // ============================================================================
1626
1627	// init Isotope
1628	var $container = $(".isotope-items-wrap");
1629	$container.imagesLoaded(function() {
1630		$container.isotope({
1631			itemSelector: ".isotope-item",
1632			layoutMode: "packery",
1633			transitionDuration: "0.7s",
1634			percentPosition: true
1635		});
1636
1637		setTimeout(function() {
1638			$container.isotope('layout'); // Refresh Isotope
1639			ScrollTrigger.refresh(true); // Refresh ScrollTrigger
1640		}, 500);
1641	});
1642
1643	// Filter
1644	$(".ttgr-cat-list > li > a, .ttgr-cat-classic-list > li > a").on("click", function() {
1645		var selector = $(this).attr("data-filter");
1646		$container.isotope({
1647			filter: selector
1648		});
1649
1650		// Refresh ScrollTrigger
1651		setTimeout(function() {
1652			ScrollTrigger.refresh(true);
1653		}, 500);
1654
1655		return false;
1656	});
1657
1658	// Filter item active
1659	var filterItemActive = $(".ttgr-cat-list > li > a, .ttgr-cat-classic-list > li > a");
1660	filterItemActive.on("click", function(){
1661		var $this = $(this);
1662		if ( !$this.hasClass("active")) {
1663			filterItemActive.removeClass("active");
1664			$this.addClass("active");
1665		}
1666	});
1667
1668
1669
1670	// =====================================================
1671	// lightGallery (lightbox plugin)
1672	// Source: http://sachinchoolur.github.io/lightGallery
1673	// Mousewheel plugin: https://github.com/jquery/jquery-mousewheel
1674	// =====================================================
1675
1676	$(".lightgallery").lightGallery({
1677
1678		// Please read about gallery options here: http://sachinchoolur.github.io/lightGallery/docs/api.html
1679
1680		// lightGallery core 
1681		selector: '.lg-trigger',
1682		mode: 'lg-fade', // Type of transition between images ('lg-fade' or 'lg-slide').
1683		height: '100%', // Height of the gallery (ex: '100%' or '300px').
1684		width: '100%', // Width of the gallery (ex: '100%' or '300px').
1685		iframeMaxWidth: '100%', // Set maximum width for iframe.
1686		loop: true, // If false, will disable the ability to loop back to the beginning of the gallery when on the last element.
1687		speed: 600, // Transition duration (in ms).
1688		closable: true, // Allows clicks on dimmer to close gallery.
1689		escKey: true, // Whether the LightGallery could be closed by pressing the "Esc" key.
1690		keyPress: true, // Enable keyboard navigation.
1691		hideBarsDelay: 3000, // Delay for hiding gallery controls (in ms).
1692		controls: true, // If false, prev/next buttons will not be displayed.
1693		mousewheel: true, // Chane slide on mousewheel.
1694		download: false, // Enable download button. By default download url will be taken from data-src/href attribute but it supports only for modern browsers. If you want you can provide another url for download via data-download-url.
1695		counter: true, // Whether to show total number of images and index 
1695number of currently displayed image.
1696		swipeThreshold: 50, // By setting the swipeThreshold (in px) you can set how far the user must swipe for the next/prev image.
1697		enableDrag: true, // Enables desktop mouse drag support.
1698		enableTouch: true, // Enables touch support.
1699		getCaptionFromTitleOrAlt: false, // Option to get captions from alt or title tags.
1700
1701		// Thumbnail plugin
1702		thumbnail: false, // Enable thumbnails for the gallery.
1703		showThumbByDefault: false, // Show/hide thumbnails by default.
1704		thumbMargin: 5, // Spacing between each thumbnails.
1705		toogleThumb: true, // Whether to display thumbnail toggle button.
1706		enableThumbSwipe: true, // Enables thumbnail touch/swipe support for touch devices.
1707		exThumbImage: 'data-exthumbnail', // If you want to use external image for thumbnail, add the path of that image inside "data-" attribute and set value of this option to the name of your custom attribute.
1708
1709		// Autoplay plugin
1710		autoplay: false, // Enable gallery autoplay.
1711		autoplayControls: true, // Show/hide autoplay controls.
1712		pause: 6000, // The time (in ms) between each auto transition.
1713		progressBar: true, // Enable autoplay progress bar.
1714		fourceAutoplay: false, // If false autoplay will be stopped after first user action
1715
1716		// Full Screen plugin
1717		fullScreen: true, // Enable/Disable fullscreen mode.
1718
1719		// Zoom plugin
1720		zoom: false, // Enable/Disable zoom option.
1721		scale: 0.5, // Value of zoom should be incremented/decremented.
1722		enableZoomAfter: 50, // Some css styles will be added to the images if zoom is enabled. So it might conflict if you add some custom styles to the images such as the initial transition while opening the gallery. So you can delay adding zoom related styles to the images by changing the value of enableZoomAfter.
1723
1724		// Video options
1725		videoMaxWidth: '1400px', // Set limit for video maximal width.
1726
1727		// Youtube video options
1728		loadYoutubeThumbnail: true, // You can automatically load thumbnails for youtube videos from youtube by setting loadYoutubeThumbnail true.
1729		youtubeThumbSize: 'default', // You can specify the thumbnail size by setting respective number: 0, 1, 2, 3, 'hqdefault', 'mqdefault', 'default', 'sddefault', 'maxresdefault'.
1730		youtubePlayerParams: { // Change youtube player parameters: https://developers.google.com/youtube/player_parameters
1731			modestbranding: 0,
1732			showinfo: 1,
1733			controls: 1
1734		},
1735
1736		// Vimeo video options
1737		loadVimeoThumbnail: true, // You can automatically load thumbnails for vimeo videos from vimeo by setting loadYoutubeThumbnail true.
1738		vimeoThumbSize: 'thumbnail_medium', // Thumbnail size for vimeo videos: 'thumbnail_large' or 'thumbnail_medium' or 'thumbnail_small'.
1739		vimeoPlayerParams: { // Change vimeo player parameters: https://developer.vimeo.com/player/embedding#universal-parameters 
1740			byline : 1,
1741			portrait : 1,
1742			title: 1,
1743			color : 'CCCCCC',
1744			autopause: 1
1745		},
1746
1747		// Hash plugin (unique url for each slides)
1748		hash: false, // Enable/Disable hash plugin.
1749		hgalleryId: 1, // Unique id for each gallery. It is mandatory when you use hash plugin for multiple galleries on the same page.
1750
1751		// Rotate plugin
1752		rotate: false,
1753
1754		// Share plugin
1755		share: false, // Enable/Disable share plugin.
1756			facebook: true, // Enable Facebook share.
1757			facebookDropdownText: 'Facebook', // Facebok dropdown text.
1758			twitter: true, // Enable Twitter share.
1759			twitterDropdownText: 'Twitter', // Twitter dropdown text.
1760			googlePlus: true, // Enable Google Plus share.
1761			googlePlusDropdownText: 'Google+', // Google Plus dropdown text.
1762			pinterest: true, // Enable Pinterest share.
1763			pinterestDropdownText: 'Pinterest' // Pinterest dropdown text.
1764
1765	});
1766
1767
1768
1769	// ================================================================
1770	// Page header
1771	// ================================================================
1772
1773	// If page header exist
1774	// =====================
1775	if ($("#page-header").length) {
1776		$("body").addClass("page-header-on");
1777
1778		// If full height enabled
1779		if ($("#page-header").hasClass("ph-full")) {
1780			$("body").addClass("ph-full-on");
1781		}
1782
1783		// If position center enabled
1784		if ($("#page-header").hasClass("ph-center")) {
1785			$("body").addClass("ph-center-on");
1786		}
1787
1788		// If page header image exist
1789		if ($(".ph-image").length) {
1790			$("body").addClass("ph-image-on");
1791
1792			// If page header image is background image
1793			if ($("#page-header").hasClass("ph-bg-image")) {
1794				$("body").addClass("ph-bg-image-on");
1795			}
1796		}
1797	}
1798
1799
1800	// If page header background image is light
1801	// =========================================
1802	if ($("#page-header").is(".ph-bg-image.ph-bg-image-is-light")) {
1803
1804		$(".ph-bg-image-is-light").on("mouseenter mouseover", function() {
1805			$("body").addClass("tt-light-bg-hover");
1806		}).on("mouseleave", function() {
1807			$("body").removeClass("tt-light-bg-hover");
1808		});
1809
1810	}
1811
1812
1813
1814	// ================================================================
1815	// Next project
1816	// ================================================================
1817
1818	if ($(".tt-np-image").length) {
1819		$("body").addClass("tt-np-image-on");
1820	}
1821
1822
1823
1824	// ================================================================
1825	// GSAP ScrollTrigger plugin
1826	// More info: https://greensock.com/docs/v3/Plugins/ScrollTrigger/
1827	// ================================================================
1828
1829	// Page header elements scrolling effects
1830	// =======================================
1831	if ($("#page-header").hasClass("ph-content-parallax")) {
1832		let tlPhParallax = gsap.timeline({ 
1833			scrollTrigger: {
1834				trigger: "#page-header", 
1835				start: 'top top', 
1836				end: 'bottom top', 
1837				scrub: true,
1838				markers: false
1839			}
1840		});
1841
1842		// Page header caption elements
1843		if ($("#page-header").hasClass("ph-bg-image")) {
1844			if ($(".ph-caption").length) {
1845				if ($("#page-header").hasClass("ph-center")) {
1846					tlPhParallax.to(".ph-caption", { y: 180, opacity: 0, scale: 0.95, transformOrigin: "center" }, 0);
1847				} else {
1848					tlPhParallax.to(".ph-caption", { y: 180, opacity: 0, scale: 0.95, transformOrigin: "left" }, 0);
1849				}
1850			}
1851			if ($(".ph-image").length) {
1852				tlPhParallax.to(".ph-image-inner", { yPercent: 30 }, 0);
1853			}
1854
1855		} else {
1856
1857			if ($(".ph-categories").length) {
1858				tlPhParallax.to(".ph-categories", { y: -220 }, 0);
1859			}
1860			if ($(".ph-caption-subtitle").length) {
1861				tlPhParallax.to(".ph-caption-subtitle", { y: -230 }, 0);
1862			}
1863			if ($(".ph-caption-title").length) {
1864				tlPhParallax.to(".ph-caption-title", { y: -180 }, 0);
1865			}
1866			if ($(".ph-caption-description").length) {
1867				tlPhParallax.to(".ph-caption-description", { y: -120 }, 0);
1868			}
1869			if ($(".ph-meta").length) {
1870				tlPhParallax.to(".ph-meta", { y: -220 }, 0);
1871			}
1872			if ($(".ph-image").length) {
1873				tlPhParallax.to(".ph-image-inner", { y: -100 }, 0);
1874			}
1875
1876			// Page header ghost
1877			var $phGhost = $(".ph-caption-title-ghost");
1878			if ($phGhost.length) {
1879				if (!$("#page-header").hasClass("ph-center")) {
1880					$phGhost.appendTo("#page-header");
1881					if ($("#page-header").hasClass("ph-ghost-scroll")) {
1882						$phGhost.find(".ph-appear").wrapInner('<span class="phgh-text"></span>');
1883						var $phghText = $phGhost.find(".phgh-text");
1884						for (var i = 0; i < 3; i++) {
1885							$phghText.clone().insertAfter($phghText);
1886						}
1887						tlPhParallax.to($phGhost, { y: -60, xPercent: -8 }, 0);
1888					} else {
1889						tlPhParallax.to($phGhost, { y: -30 }, 0);
1890					}
1891				} else {
1892					tlPhParallax.to($phGhost, { y: -60 }, 0);
1893				}
1894			}
1895
1896		}
1897
1898		// Page header scroll down circle
1899		if ($(".tt-scroll-down").length) {
1900			gsap.to(".tt-scroll-down", { 
1901				// y: 100,
1902				autoAlpha: 0,
1903				ease: "none",
1904				scrollTrigger: {
1905					trigger: "#page-header",
1906					start: "top top",
1907					end: "30% top",
1908					scrub: true,
1909					markers: false
1910				}, 
1911			});
1912		}
1913
1914		// Page header projekt share
1915		if ($(".ph-share").length) {
1916			gsap.to(".ph-share-inner", { 
1917				// y: 100,
1918				autoAlpha: 0,
1919				ease: "none",
1920				scrollTrigger: {
1921					trigger: "#page-header",
1922					start: "top top",
1923					end: "30% top",
1924					scrub: true,
1925					markers: false
1926				}, 
1927			});
1928		}
1929	}
1930
1931	// If page header is visible
1932	if ($("#page-header").length) {
1933		ScrollTrigger.create({
1934			trigger: "#page-header",
1935			start: "top bottom",
1936			end: "bottom 60px",
1937			scrub: true,
1938			markers: false,
1939
1940			onLeave: () => phVisibleLeaveClass(),
1941			onEnter: () => phVisibleEnterClass(),
1942			onLeaveBack: () => phVisibleLeaveClass(),
1943			onEnterBack: () => phVisibleEnterClass(),
1944		});
1945
1946		function phVisibleLeaveClass() {
1947			$("body").removeClass("tt-ph-visible");
1948		};
1949		function phVisibleEnterClass() {
1950			$("body").addClass("tt-ph-visible");
1951		};
1952	}
1953
1954	// If page header background image is light
1955	if ($("#page-header").is(".ph-bg-image.ph-bg-image-is-light")) {
1956		ScrollTrigger.create({
1957			trigger: "#page-header",
1958			start: "top bottom",
1959			end: "bottom 30px",
1960			scrub: true,
1961			markers: false,
1962
1963			onLeave: () => phLightLeaveClass(),
1964			onEnter: () => phLightEnterClass(),
1965			onLeaveBack: () => phLightLeaveClass(),
1966			onEnterBack: () => phLightEnterClass(),
1967		});
1968
1969		function phLightLeaveClass() {
1970			$("body").removeClass("tt-light-bg-on");
1971		};
1972		function phLightEnterClass() {
1973			$("body").addClass("tt-light-bg-on");
1974		};
1975	}
1976
1977
1978	// Portfolio grid categories filter show/hide on scroll
1979	// =====================================================
1980	if ($(".tt-grid-categories").length) {
1981		
1982		var $ttgCatTriggerWrap = $(".ttgr-cat-trigger-wrap");
1983
1984		if ($ttgCatTriggerWrap.hasClass("ttgr-cat-fixed")) {
1985			$ttgCatTriggerWrap.appendTo("#body-inner");
1986			$("body").addClass("ttgr-cat-fixed-on");
1987
1988			// Show/Hide trigger on page scroll
1989			ScrollTrigger.create({
1990				trigger: "#portfolio-grid",
1991				start: "top bottom",
1992				end: "bottom 75%",
1993				scrub: true,
1994				markers: false,
1995
1996				onEnter: () => ttgCatShow(),
1997				onLeave: () => ttgCatHide(),
1998				onEnterBack: () => ttgCatShow(),
1999				onLeaveBack: () => ttgCatHide(),
2000			});
2001
2002			function ttgCatShow() {
2003				gsap.to($ttgCatTriggerWrap, { duration: 0.4, autoAlpha: 1, scale: 1, ease:Power2.easeOut });
2004			}
2005			function ttgCatHide() {
2006				gsap.to($ttgCatTriggerWrap, { duration: 0.4, autoAlpha: 0, scale: 0.9, ease:Power2.easeOut });
2007			}
2008
2009		} else {
2010
2011			// Hide trigger before it reaches the top when page scroll
2012			gsap.to($ttgCatTriggerWrap, { 
2013				yPercent: 70,
2014				autoAlpha: 0,
2015				ease: "none",
2016				scrollTrigger: {
2017					trigger: $ttgCatTriggerWrap,
2018					start: "top 250px",
2019					end: "100px 250px",
2020					scrub: true,
2021					markers: false
2022				}, 
2023			});
2024
2025		}
2026	}
2027
2028
2029	// Portfolio list item elements scrolling effects
2030	// ===============================================
2031	$(".pli-caption").each(function() {
2032		var $pliTitle = $(this).find(".pli-title");
2033		var $pliCategory = $(this).find(".pli-categories-wrap");
2034		var $pliCounter = $(this).parents(".portfolio-list-item").find(".pli-counter");
2035
2036		let tl_plIInfo = gsap.timeline({
2037			scrollTrigger: {
2038				trigger: this,
2039				start: "top bottom",
2040				markers: false
2041			}
2042		});
2043
2044		ScrollTrigger.matchMedia({
2045			"(min-width: 768px)": function() {
2046				if ($($pliTitle).length) {
2047					tl_plIInfo.fromTo($pliTitle, { autoAlpha: 0, x: 60, scaleX: 1.3, transformOrigin: "left" }, { duration: 2, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", ease: Expo.easeOut, clearProps:"all" }, "+=0.3");
2048				}
2049				if ($($pliCategory).length) {
2050					tl_plIInfo.fromTo($pliCategory, { autoAlpha: 0, x: 60, scaleX: 1.3, transformOrigin: "left" }, { duration: 2, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", ease: Expo.easeOut, clearProps:"all" }, "-=1.7");
2051				}
2052				if ($($pliCounter).length) {
2053					tl_plIInfo.fromTo($pliCounter, { autoAlpha: 0, x: 60, scaleX: 1.3, transformOrigin: "left" }, { duration: 2, autoAlpha: 1, x: 0, scaleX: 1, transformOrigin: "left", ease: Expo.easeOut, clearProps:"all" }, "-=1.8");
2054				}
2055			},
2056
2057			"(max-width: 767px)": function() {
2058				if ($($pliTitle).length) {
2059					tl_plIInfo.from($pliTitle, { duration: 2, autoAlpha: 0, y: 40, ease: Expo.easeOut, clearProps:"all" }, "+=0.5");
2060				}
2061				if ($($pliCategory).length) {
2062					tl_plIInfo.from($pliCategory, { duration: 2, autoAlpha: 0, y: 20, ease: Expo.easeOut, clearProps:"all" }, "-=1.7");
2063				}
2064			}
2065		});
2066	});
2067	
2068
2069	// Image parallax
2070	// ===============
2071	$(".anim-image-parallax").each(function() {
2072
2073		// Add wrap <div>.
2074		$(this).wrap('<div class="anim-image-parallax-wrap"><div class="anim-image-parallax-inner"></div></div>');
2075
2076		// Add overflow hidden.
2077		$(".anim-image-parallax-wrap").css({ "overflow": "hidden" });
2078
2079		var $animImageParallax = $(this);
2080		var $aipWrap = $animImageParallax.parents(".anim-image-parallax-wrap");
2081		var $aipInner = $aipWrap.find(".anim-image-parallax-inner");
2082
2083		let tl_ImageParallax = gsap.timeline({
2084			scrollTrigger: {
2085				trigger: $aipWrap,
2086				start: "top bottom",
2087				end: "bottom top",
2088				scrub: true,
2089				markers: false,
2090				onEnter: () => animImgParallaxRefresh(),
2091			},
2092		});
2093		tl_ImageParallax.to($animImageParallax, { yPercent: 30, ease: "none" });
2094
2095		function animImgParallaxRefresh() {
2096			tl_ImageParallax.scrollTrigger.refresh();
2097		}
2098
2099		// Zoom in
2100		let tl_aipZoomIn = gsap.timeline({
2101			scrollTrigger: {
2102				trigger: $aipWrap,
2103				start: "top 90%",
2104				markers: false,
2105			}
2106		});
2107		tl_aipZoomIn.from($aipInner, { duration: 1.5, autoAlpha: 0, scale: 1.2, ease: Power2.easeOut, clearProps:"all" });
2108		
2109	});
2110
2111
2112	// tt-Grid "layout-creative" parallax
2113	// ===================================
2114	ScrollTrigger.matchMedia({
2115		"(min-width: 768px)": function() {
2116			$(".tt-grid.ttgr-layout-creative-1 .tt-grid-item:nth-of-type(6n+2) .ttgr-item-inner, .tt-grid.ttgr-layout-creative-1 .tt-grid-item:nth-of-type(6n+4) .ttgr-item-inner, .tt-grid.ttgr-layout-creative-2 .tt-grid-item:nth-of-type(4n+2) .ttgr-item-inner, .tt-grid.ttgr-layout-creative-2 .tt-grid-item:not(:last-child):nth-of-type(4n+3) .ttgr-item-inner").each(function() {
2117				var $this = $(this);
2118
2119				gsap.to($this, {
2120					yPercent: -50,
2121					ease: "none",
2122					scrollTrigger: {
2123						trigger: $this,
2124						start: "top bottom",
2125						end: "bottom top",
2126						scrub: true,
2127						markers: false,
2128						onEnter: () => ttgrItemParalRefresh(),
2129					}, 
2130				});
2131
2132				// Refresh start/end positions on enter.
2133				function ttgrItemParalRefresh() {
2134					ScrollTrigger.refresh(true);
2135				};
2136
2137			});
2138		}
2139	});
2140
2141
2142	// Next project parallax
2143	// ======================
2144	if ($(".tt-np-image").length) {
2145		gsap.from(".tt-np-image", {
2146			yPercent: -30,
2147			opacity: 0,
2148			ease: "none",
2149			scrollTrigger: {
2150				trigger: ".tt-next-project",
2151				start: "5% bottom",
2152				end: "bottom bottom",
2153				scrub: true,
2154				markers: false,
2155			}, 
2156		});
2157
2158		if ($(".tt-np-caption").length) {
2159			gsap.from(".tt-np-caption", {
2160				yPercent: -70,
2161				opacity: 0,
2162				scale: 0.96,
2163				transformOrigin: "left",
2164				ease: "none",
2165				scrollTrigger: {
2166					trigger: $(".tt-next-project"),
2167					start: "15% bottom",
2168					end: "bottom bottom",
2169					scrub: true,
2170					markers: false,
2171				}, 
2172			});
2173		}
2174
2175	} else {
2176
2177		if ($(".tt-np-caption").length) {
2178			gsap.from(".tt-np-caption", {
2179				yPercent: -10,
2180				opacity: 0,
2181				scale: 0.96,
2182				ease: "none",
2183				scrollTrigger: {
2184					trigger: $(".tt-next-project"),
2185					start: "40% bottom",
2186					end: "bottom bottom",
2187					scrub: true,
2188					markers: false,
2189				}, 
2190			});
2191		}
2192	}
2193
2194	// If next project is touches the top of the page
2195	if ($(".tt-next-project").length) {
2196		ScrollTrigger.create({
2197			trigger: ".tt-next-project",
2198			start: "top 90px",
2199			end: "bottom top",
2200			scrub: true,
2201			markers: false,
2202
2203			onLeave: () => ttNpTopLeaveClass(),
2204			onEnter: () => ttNpTopEnterClass(),
2205			onLeaveBack: () => ttNpTopLeaveClass(),
2206			onEnterBack: () => ttNpTopEnterClass(),
2207		});
2208
2209		function ttNpTopLeaveClass() {
2210			$("body").removeClass("tt-next-project-top");
2211		};
2212		function ttNpTopEnterClass() {
2213			$("body").addClass("tt-next-project-top");
2214		};
2215	}
2216
2217	// If next project background image is light
2218	if ($(".tt-next-project").hasClass("tt-np-image-is-light")) {
2219		ScrollTrigger.create({
2220			trigger: ".tt-next-project",
2221			start: "top 90px",
2222			end: "bottom top",
2223			scrub: true,
2224			markers: false,
2225
2226			onLeave: () => ttNpLightLeaveClass(),
2227			onEnter: () => ttNpLightEnterClass(),
2228			onLeaveBack: () => ttNpLightLeaveClass(),
2229			onEnterBack: () => ttNpLightEnterClass(),
2230		});
2231
2232		function ttNpLightLeaveClass() {
2233			$("body").removeClass("tt-light-bg-on");
2234		};
2235		function ttNpLightEnterClass() {
2236			$("body").addClass("tt-light-bg-on");
2237		};
2238
2239		// Hover
2240		$(".tt-next-project").on("mouseenter mouseover", function() {
2241			$("body").addClass("tt-light-bg-hover");
2242		}).on("mouseleave", function() {
2243			$("body").removeClass("tt-light-bg-hover");
2244		});
2245
2246	}
2247
2248
2249	// Skew on scroll (https://codepen.io/GreenSock/pen/eYpGLYL)
2250	// ===============
2251	if(!isMobile) { // Not for mobile devices!
2252
2253		var skewElement = $(".skew-on-scroll"); // Skew element class.
2254		var skewMaxAngle = 7; // Max angle.
2255		var skewVelocity = 500; // Velocity.
2256		var skewDuration = 0.5; // Duration.
2257
2258		var proxy = { skew: 0 },
2259			 skewSetter = gsap.quickSetter(skewElement, "skewY", "deg"),
2260			 clamp = gsap.utils.clamp(-skewMaxAngle, skewMaxAngle);
2261		
2262		if (skewElement.length) {
2263
2264			function skewer() {
2265				ScrollTrigger.create({
2266					onUpdate: (self) => {
2267						var skew = clamp(self.getVelocity() / -skewVelocity);
2268						if (Math.abs(skew) > Math.abs(proxy.skew)) {
2269							proxy.skew = skew;
2270							gsap.to(proxy, {skew: 0, duration: skewDuration, ease: "power1.easeInOut", overwrite: true, onUpdate: () => skewSetter(proxy.skew)});
2271						}
2272					}
2273				});
2274			}
2275
2276			function skewerIfSmoothScroll() {
2277				var bodyScrollBar = Scrollbar.init(document.getElementById("scroll-container"));
2278
2279				ScrollTrigger.scrollerProxy("#scroll-container", {
2280					scrollTop(value) {
2281						if (arguments.length) {
2282							bodyScrollBar.scrollTop = value;
2283						}
2284						return bodyScrollBar.scrollTop; 
2285					}
2286				});
2287
2288				ScrollTrigger.create({
2289					scroller: "#scroll-container",
2290					onUpdate: (self) => {
2291						var skew = clamp(self.getVelocity() / -skewVelocity);
2292						if (Math.abs(skew) > Math.abs(proxy.skew)) {
2293							proxy.skew = skew;
2294							gsap.to(proxy, {skew: 0, duration: skewDuration, ease: "power1.easeInOut", overwrite: true, onUpdate: () => skewSetter(proxy.skew)});
2295						}
2296					}
2297				});
2298			}
2299
2300			if ($("body").hasClass("tt-smooth-scroll")) {
2301				if(isMobile) {
2302					skewer();
2303				} else {
2304					skewerIfSmoothScroll();
2305				} 
2306			} else {
2307				skewer();
2308			}
2309
2310			gsap.set(skewElement, {transformOrigin: "center center", force3D: true}); // Change transform origin if needed.
2311		}
2312
2313	}
2314
2315
2316	// Scrolling button
2317	// =================
2318	if ($(".tt-scrolling-btn").length) {
2319		$(".tt-scrolling-btn").each(function() {
2320			var $this = $(this);
2321			var $scrBtnSvg = $this.find(".scr-btn-spinner");
2322			gsap.from($scrBtnSvg, {
2323				rotate: 240,
2324				ease: "none",
2325				scrollTrigger: {
2326					trigger: $scrBtnSvg,
2327					start: "-40% bottom",
2328					end: "120% top",
2329					scrub: true,
2330					markers: false,
2331				}, 
2332			});
2333		});
2334	}
2335
2336
2337	// Appear on scroll
2338	// =================
2339
2340	// zoom in
2341	$(".anim-zoomin").each(function() {
2342
2343		// Add wrap <div>.
2344		$(this).wrap('<div class="anim-zoomin-wrap"></div>');
2345
2346		// Add overflow hidden.
2347		$(".anim-zoomin-wrap").css({ "overflow": "hidden" })
2348
2349		var $this = $(this);
2350		var $asiWrap = $this.parents(".anim-zoomin-wrap");
2351
2352		let tl_ZoomIn = gsap.timeline({
2353			scrollTrigger: {
2354				trigger: $asiWrap,
2355				start: "top bottom",
2356				markers: false,
2357				onEnter: () => animZoomInRefresh(),
2358			}
2359		});
2360		tl_ZoomIn.from($this, { duration: 1.5, autoAlpha: 0, scale: 1.2, ease: Power2.easeOut, clearProps:"all" });
2361
2362		// Refresh start/end positions on enter.
2363		function animZoomInRefresh() {
2364			ScrollTrigger.refresh();
2365		};
2366	});
2367
2368
2369	// fade in-up
2370	$("body:not(.tt-disable-ani) .anim-fadeinup").each(function() {
2371		let tl_FadeInUp = gsap.timeline({
2372			scrollTrigger: {
2373				trigger: this,
2374				start: "top bottom",
2375				markers: false
2376			}
2377		});
2378
2379		tl_FadeInUp.from(this, { duration: 2.5, autoAlpha: 0, y: 100, ease: Expo.easeOut, clearProps:"all" }, "+=0.3");
2380	});
2381
2382
2383	// skew in-up
2384	$("body:not(.tt-disable-ani) .anim-skewinup").each(function() {
2385		let tl_SkewInUp = gsap.timeline({
2386			scrollTrigger: {
2387				trigger: this,
2388				start: "top bottom",
2389				markers: false
2390			}
2391		});
2392
2393		tl_SkewInUp.from(this, { duration: 2, skewY: 5, transformOrigin: "left top", autoAlpha: 0, y: 100, ease: Expo.easeOut, clearProps:"all" }, "+=0.3");
2394	});
2395
2396
2397
2398	// ================================================================
2399	// Portfolio thumbnail list
2400	// ================================================================
2401
2402	// Item hover
2403	$(".ptl-item").each(function() {
2404		let $ptliImage = $(this).find(".ptli-image");
2405		$(this).on("mouseenter", function() {
2406			let tl_ptliWave = gsap.timeline({ defaults: { duration: 0.2, stagger: 0.1 }});
2407				tl_ptliWave.to($ptliImage, { y: -10 });
2408				tl_ptliWave.to($ptliImage, { y: 0, clearProps:"all" }, 0.2);
2409		});
2410	});
2411
2412
2413
2414	// ================================================================
2415	// Portfolio interactive
2416	// ================================================================
2417
2418	$(".portfolio-interactive-images, .portfolio-interactive-ghost").appendTo("#body-inner");
2419
2420	if ($(".portfolio-interactive").hasClass("pi-inline")) {
2421		$("body").addClass("pi-inline-on");
2422	}
2423
2424	if ($(".portfolio-interactive").hasClass("pi-center")) {
2425		$("body").addClass("pi-center-on");
2426	}
2427
2428	if ($(".portfolio-interactive").hasClass("pi-full")) {
2429		$("body").addClass("pi-full-on");
2430
2431		// Move "tt-footer" out of "scroll-container"
2432		// Expl: Since Smooth Scrollbar doesn't support element fixed position inside "scroll-container" move the "tt-footer" out of it.
2433		// ==========================================
2434		if ($("body").hasClass("tt-smooth-scroll")) {
2435			function moveFooter() {
2436				if (window.matchMedia("(min-width: 1025px)").matches) {
2437					$("#tt-footer").appendTo("#body-inner");
2438				} else {
2439					$("#tt-footer").appendTo("#content-wrap");
2440				}
2441			};
2442			moveFooter();
2443
2444			$(window).resize(function() {
2445				moveFooter();
2446			});
2447		}
2448		
2449	}
2450
2451
2452	// Item link hover
2453	// ================
2454	$(".portfolio-interactive-item").each(function() {
2455		var $piItem = $(this);
2456		$piItem.find(".pi-item-title-link").on("mouseenter", function() {
2457
2458			// hover title
2459			$(this).parents(".portfolio-interactive").addClass("hovered");
2460			$(this).parent().addClass("pi-item-hover");
2461
2462			// hover video
2463			var $piItemVideo = $(this).parents("body").find(".pi-item-image video");
2464			if ($piItemVideo.length) {
2465				$piItemVideo.get(0).play();
2466			}
2467
2468		}).on("mouseleave", function() {
2469
2470			// hover title
2471			$(this).parents(".portfolio-interactive").removeClass("hovered");
2472			$(this).parent().removeClass("pi-item-hover");
2473
2474			// hover video
2475			var $piItemVideo = $(this).parents("body").find(".pi-item-image video");
2476			if ($piItemVideo.length) {
2477				$piItemVideo.get(0).pause();
2478			}
2479		});
2480	});
2481
2482
2483	// If item image is light
2484	// =======================
2485	$(".pi-item-image").each(function() {
2486		if ($(this).hasClass("pi-item-image-is-light")) {
2487			$(this).parents(".portfolio-interactive-item").addClass("pi-item-light-image-on");
2488		}
2489	});
2490
2491
2492
2493	// ================================================================
2494	// Portfolio split
2495	// ================================================================
2496
2497	if ($(".portfolio-split-off").length) {
2498		$("body").addClass("portfolio-split-on");
2499
2500		// Move elements out of "scroll-container" if the Smooth Scrollbar is enabled.
2501		// Expl: Since Smooth Scrollbar doesn't support element fixed position inside "scroll-container" move the elements out of it.
2502		// ==========================================
2503		if ($("body").hasClass("tt-smooth-scroll")) {
2504
2505			// Move "portfolio-split-images" out of "scroll-container".
2506			$(".portfolio-split-images, .pspl-ghost").appendTo("#body-inner");
2507
2508			// Move "tt-footer" out of "scroll-container".
2509			function moveFooter() {
2510				if (window.matchMedia("(min-width: 1025px)").matches) {
2511					$("#tt-footer").appendTo("#body-inner");
2512				} else {
2513					$("#tt-footer").appendTo("#content-wrap");
2514				}
2515			};
2516			moveFooter();
2517
2518			$(window).resize(function() {
2519				moveFooter();
2520			});
2521		}
2522		
2523
2524		// List item link hover
2525		// =====================
2526		$(".portfolio-split-item").each(function() {
2527			var $psplItem = $(this);
2528			$psplItem.find(".pspl-item-title-link").on("mouseenter", function() {
2529				
2530				$(this).parents(".portfolio-split").addClass("hovered");
2531				if (!$(this).parents(".portfolio-split-item").hasClass("pspl-item-hover")) {
2532					var indexElem = $(this).parents(".portfolio-split-item").index();
2533					$(this).parents(".portfolio-split-item").addClass("pspl-item-hover").siblings().removeClass("pspl-item-hover");
2534					$(".portfolio-split-images").find(".pspl-image").removeClass("active").eq(indexElem).addClass("active");
2535
2536					if ($(".pspl-video").length) {
2537						$(".pspl-video").each(function() {
2538							if ($(this).parents(".pspl-image").hasClass("active")) {
2539								$(this).get(0).play();
2540							} else {
2541								$(this).get(0).pause();
2542							}
2543						});
2544					}
2545				}
2546
2547				psplImage();
2548
2549			}).on("mouseleave", function() {
2550				$(this).parents(".portfolio-split").removeClass("hovered");
2551			});
2552			
2553		});
2554
2555
2556		// If image is light and active
2557		// =============================
2558		function psplImage() {
2559			function psplImageLightActive() {
2560				if ($(".pspl-image.pspl-image-is-light").hasClass("active")) {
2561					$("body").addClass("pspl-light-image-on");
2562				} else {
2563					$("body").removeClass("pspl-light-image-on");
2564				}
2565			};
2566			psplImageLightActive();
2567
2568			$(window).resize(function() {
2569				psplImageLightActive();
2570			});
2571			$( window ).on( "orientationchange", function() {
2572				psplImageLightActive();
2573			});
2574		};
2575		psplImage();
2576
2577
2578		// Reversed layout
2579		// ================
2580		if ($(".portfolio-split").hasClass("pspl-reverse")) {
2581			$("body").addClass("pspl-reverse-on")
2582		}
2583
2584	}
2585
2586
2587
2588	// ================================================================
2589	// Portfolio list
2590	// ================================================================
2591
2592	// Play video on hover
2593	$(".portfolio-list-item").on("mouseenter touchstart", function() {
2594		$(this).find("video").each(function() {
2595			$(this).get(0).play();
2596		}); 
2597	}).on("mouseleave touchend", function() {
2598		$(this).find("video").each(function() {
2599			$(this).get(0).pause();
2600		});
2601	});
2602
2603	// Item image zoom on hover
2604	$(".portfolio-list-item").each(function() {
2605		if ($(".portfolio-list").hasClass("pli-hover")) {
2606			$(this).find(".pli-image img").wrap('<div class="pli-image-hover-zoom"></div>');
2607		}
2608	});
2609
2610
2611
2612	// ================================================================
2613	// Portfolio grid
2614	// ================================================================
2615
2616	// If "pgi-cap-inside enabled
2617	// ===========================
2618	if ($("#portfolio-grid").hasClass("pgi-cap-inside")) {
2619
2620		// Move "pgi-caption" to inside "pgi-image-wrap".
2621		$(".portfolio-grid-item").each(function() {
2622			$(this).find(".pgi-caption").appendTo($(this).find(".pgi-image-wrap"));
2623		});
2624
2625		// Remove grid item title anchor tag if exist.
2626		if ($(".pgi-title a").length) {
2627			$(".pgi-title a").contents().unwrap();
2628		}
2629	}
2630
2631
2632	// Play video on hover
2633	// ====================
2634	if(!isMobile) {
2635	$(".pgi-image-wrap").on("mouseenter touchstart", function() {
2636		$(this).find("video").each(function() {
2637			$(this).get(0).play();
2638		}); 
2639	}).on("mouseleave touchend", function() {
2640		$(this).find("video").each(function() {
2641			$(this).get(0).pause();
2642		});
2643	});
2644	}
2645
2646	// Portfolio grid categories filter
2647	// =================================
2648	$(".ttgr-cat-nav").appendTo("#body-inner");
2649
2650	// On category trigger click.
2651	$(".ttgr-cat-trigger").on("click", function() {
2652		$("body").addClass("ttgr-cat-nav-open");
2653		if ($("body").hasClass("ttgr-cat-nav-open")) {
2654
2655			gsap.to(".portfolio-grid-item", { duration: 0.3, scale: 0.9 });
2656			gsap.to(".pgi-caption, #page-header, .ttgr-cat-trigger", { duration: 0.3, autoAlpha: 0 });
2657
2658			// Make "ttgr-cat-nav" unclickable.
2659			$(".ttgr-cat-nav").off("click");
2660
2661			// Catecories step in animations.
2662			var tl_ttgrIn = gsap.timeline({
2663				// Wait until the timeline is completed then make "ttgr-cat-nav" clickable again.
2664				onComplete: function() {  
2665					ttCatNavClose();
2666				}
2667			});
2668			tl_ttgrIn.to(".ttgr-cat-nav", { duration: 0.3, autoAlpha: 1 });
2669			tl_ttgrIn.from(".ttgr-cat-list > li", { duration: 0.3, y: 80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeOut, clearProps:"all" });
2670
2671			// On catecory link click
2672			$(".ttgr-cat-nav a")
2673			.not('[target="_blank"]') // omit from selection
2674			.not('[href^="#"]') // omit from selection
2675			.not('[href^="mailto"]') // omit from selection
2676			.not('[href^="tel"]') // omit from selection
2677			.on('click', function() {
2678				gsap.to(".ttgr-cat-list > li", { duration: 0.3, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
2679			});
2680		}
2681	});
2682
2683	// On close click function
2684	function ttCatNavClose() {
2685		$(".ttgr-cat-nav").on("click", function() {
2686			$("body").removeClass("ttgr-cat-nav-open");
2687
2688			// Catecories step out animations
2689			var tl_ttgrClose = gsap.timeline();
2690				 tl_ttgrClose.to(".ttgr-cat-list > li", { duration: 0.3, y: -80, autoAlpha: 0, stagger: 0.05, ease: Power2.easeIn });
2691				 tl_ttgrClose.to(".ttgr-cat-nav", { duration: 0.3, autoAlpha: 0, clearProps:"all" }, "+=0.2");
2692				 tl_ttgrClose.to(".portfolio-grid-item", { duration: 0.3, scale: 1, clearProps:"all" }, "-=0.4");
2693				 tl_ttgrClose.to(".pgi-caption, #page-header, .ttgr-cat-trigger", { duration: 0.3, autoAlpha: 1, clearProps:"all" }, "-=0.4");
2694				 tl_ttgrClose.to(".ttgr-cat-list > li", { clearProps:"all" }); // clearProps only
2695		});
2696	}
2697
2698
2699
2700	// ================================================================
2701	// tt-Gallery
2702	// ================================================================
2703
2704	// Play video on hover
2705	$(".tt-gallery-video-wrap").on("mouseenter touchstart", function() {
2706		$(this).find("video").each(function() {
2707			$(this).get(0).play();
2708		}); 
2709	}).on("mouseleave touchend", function() {
2710		$(this).find("video").each(function() {
2711			$(this).get(0).pause();
2712		});
2713	});
2714
2715	// Gallery item image zoom on hover
2716	$(".tt-gallery-item").each(function() {
2717		if ($(".tt-gallery").hasClass("ttga-hover")) {
2718			$(this).find(".tt-gallery-image img").wrap('<div class="tt-gallery-image-hover-zoom"></div>');
2719		}
2720	});
2721
2722
2723
2724	// ================================================================
2725	// Accordion
2726	// ================================================================
2727
2728	$(".tt-accordion").each(function() {
2729
2730		// If accordion content has class "is-open"
2731		$(this).find(".tt-accordion-item").each(function() {
2732			var $this = $(this);
2733
2734			if ($this.find(".tt-accordion-content").hasClass("is-open")) {
2735				$this.addClass("active");
2736			}
2737		});
2738
2739		// Accordion item on click
2740		$(this).find(".tt-accordion-heading").on("click", function() {
2741			var $this = $(this);
2742
2743			if ($this.parents(".tt-accordion-item").hasClass("active")) {
2744				$this.parents(".tt-accordion-item").removeClass("active");
2745				$this.next(".tt-accordion-content").slideUp(350);
2746			} else {
2747				$this.parent().parent().find(".tt-accordion-item").removeClass("active");
2748				$this.parent().parent().find(".tt-accordion-content").slideUp(350);
2749				$this.parents(".tt-accordion-item").toggleClass("active");
2750				$this.next(".tt-accordion-content").slideToggle(350);
2751			}
2752			return false;
2753		});
2754	});
2755
2756
2757
2758	// ==================================
2759	// Sidebar (classic)
2760	// ==================================
2761
2762	// If tt-sidebar exist.
2763	if ($(".tt-sidebar").length) {
2764
2765		$("body").addClass("tt-sidebar-on");
2766
2767		// If tt-sidebar has class "sidebar-left" add class "sidebar-left-on" to <pody>.
2768		if ($(".tt-sidebar").hasClass("sidebar-left")) {
2769			$("body").addClass("tt-sidebar-left-on");
2770		}
2771
2772		// If tt-sidebar has class "sidebar-right" add class "sidebar-right-on" to <pody>.
2773		if ($(".tt-sidebar").hasClass("sidebar-right")) {
2774			$("body").addClass("tt-sidebar-right-on");
2775		}
2776	}
2777
2778
2779
2780	// ==================================
2781	// Sliding sidebar
2782	// ==================================
2783
2784	// If sliding sidebar exist.
2785	if ($(".tt-sliding-sidebar-wrap").length) {
2786
2787		$("body").addClass("tt-sliding-sidebar-on tt-sliding-sidebar-left-on");  // left position is by default.
2788
2789		// Append sliding sidebar.
2790		$(".tt-sliding-sidebar-wrap").appendTo("#body-inner");
2791
2792		// Open/close sliding sidebar.
2793		$(".tt-sliding-sidebar-trigger").on("click", function() {
2794			$("body").toggleClass("tt-sliding-sidebar-open");
2795		}); 
2796		$(".tt-sliding-sidebar-close").on("click", function() {
2797			$("body").removeClass("tt-sliding-sidebar-open");
2798		}); 
2799
2800		// If sliding sidebar has class "tt-ss-right" add class "tt-ss-right-on" to <pody>.
2801		if ($(".tt-sliding-sidebar-wrap").hasClass("tt-ss-right")) {
2802			$("body").removeClass("tt-sliding-sidebar-left-on");
2803			$("body").addClass("tt-sliding-sidebar-right-on");
2804		}
2805	}
2806
2807
2808
2809	// ==================================
2810	// Scrolling text
2811	// ==================================
2812
2813	// Hover scrolling speed.
2814	$(".tt-scrolling-text").each(function() {
2815		var $tt_stSpeed = $(this).data("scroll-speed");
2816		$(this).find(".tt-scrolling-text-inner").css({ 
2817			"animation-duration": $tt_stSpeed + "s",
2818		});
2819	});
2820
2821
2822
2823	// ================================================================
2824	// Scroll between anchors 
2825	// Requires "Smooth Scrollbar" (https://github.com/idiotWu/smooth-scrollbar/blob/develop/docs/api.md#scrollbarscrollintoview)
2826	// ================================================================
2827
2828	$('a[href^="#"]')
2829		.not('[href$="#"]') // omit from selection
2830		.not('[href$="#0"]') // omit from selection
2831		.on("click", function() {
2832
2833		var target = this.hash;
2834
2835		// If fixed header position enabled.
2836		if ($("#tt-header").hasClass("tt-header-fixed")) {
2837			var $offset = $("#tt-header").height();
2838		} else {
2839			var $offset = 0;
2840		}
2841
2842		// You can use data attribute (for example: data-offset="100") to set top offset in HTML markup if needed. 
2843		if ($(this).data("offset") != undefined) $offset = $(this).data("offset");
2844		
2845		if(!isMobile) { // Not for mobile devices!
2846			if ($("body").hasClass("tt-smooth-scroll")) {
2847				var topY = $(target).offset().top - $("#scroll-container > .scroll-content").offset().top - $offset;
2848				var $scrollbar = Scrollbar.init(document.getElementById("scroll-container"));
2849				gsap.to($scrollbar, { duration: 1.5, scrollTo: { y: topY, autoKill: true }, ease: Expo.easeInOut });
2850
2851			} else {
2852				var topY = $(target).offset().top - $("body").offset().top - $offset;
2853				$("html,body").animate({scrollTop: topY}, 800);
2854			}
2855		} else {
2856			var topY = $(target).offset().top - $("body").offset().top - $offset;
2857			$("html,body").animate({scrollTop: topY}, 800);
2858		}
2859		return false;
2860	});
2861
2862
2863
2864	// ================================================================
2865	// Scroll to top 
2866	// Requires "GSAP ScrollToPlugin" (https://greensock.com/docs/v2/Plugins/ScrollToPlugin)
2867	// ================================================================
2868
2869	$(".scroll-to-top").on("click", function() {
2870		if(!isMobile) { // Not for mobile devices!
2871			if ($("body").hasClass("tt-smooth-scroll")) {
2872				var $scrollbar = Scrollbar.init(document.getElementById("scroll-container"));
2873				gsap.to($scrollbar, { duration: 1.5, scrollTo: { y: 0, autoKill: true }, ease: Expo.easeInOut });
2874			} else {
2875				$("html,body").animate({scrollTop: 0}, 800);
2876			}
2877		} else {
2878			$("html,body").animate({scrollTop: 0}, 800);
2879		}
2880		return false;
2881	}); 
2882
2883
2884
2885	// =======================================================================================
2886	// Defer videos (Youtube, Vimeo)
2887	// Note: When you have embed videos in your webpages it causes your page to load slower.
2888	// Deffering will allow your page to load quickly.
2889	// Source: https://www.feedthebot.com/pagespeed/defer-videos.html
2890	// =======================================================================================
2891
2892	function init() {
2893	var vidDefer = document.getElementsByTagName("iframe");
2894	for (var i=0; i<vidDefer.length; i++) {
2895	if(vidDefer[i].getAttribute("data-src")) {
2896	vidDefer[i].setAttribute("src",vidDefer[i].getAttribute("data-src"));
2897	} } }
2898	window.onload = init;
2899
2900
2901
2902	// ================================================================
2903	// Forms
2904	// ================================================================
2905
2906	// Remove input placeholder on focus
2907	$("input,textarea").focus(function () {
2908		$(this).data("placeholder", $(this).attr("placeholder"))
2909			.attr("placeholder", "");
2910	}).blur(function () {
2911		$(this).attr("placeholder", $(this).data("placeholder"));
2912	}); 
2913
2914	// Form "Browse File" button info
2915	$(document).on("change", ":file", function() {
2916		var input = $(this),
2917		numFiles = input.get(0).files ? input.get(0).files.length : 1,
2918		label = input.val().replace(/\\/g, "/").replace(/.*\//, "");
2919		input.trigger("fileselect", [numFiles, label]);
2920	});
2921	$(":file").on("fileselect", function(event, numFiles, label) {
2922		var input = $(this).parents(".tt-form-file").find(".tt-file-info"),
2923		log = numFiles > 1 ? numFiles + " files selected" : label;
2924
2925		if( input.length ) {
2926			input.val(log);
2927		} else {
2928			if( log ) alert(log);
2929		}
2930	});
2931
2932
2933	// Universal PHP Mail Feedback Script 
2934	// (https://github.com/agragregra/uniMail)
2935	// ========================================
2936
2937	// E-mail Ajax Send
2938	$("#tt-contact-form").submit(function() { // Change (your contact form ID)
2939		var th = $(this);
2940		$.ajax({
2941			type: "POST",
2942			url: "mail.php", // Change (mail.php path)
2943			data: th.serialize()
2944		}).done(function() {
2945			alert("Thank you. Your message has been sent!");
2946			setTimeout(function() {
2947			// Done Functions
2948			th.trigger("reset");
2949			}, 800);
2950		});
2951		return false;
2952	});
2953
2954
2955
2956	// =======================================================================================
2957	// Magic cursor (no effect on small screens!)
2958	// https://codepen.io/Sahil89/pen/MQbdNR
2959	// https://greensock.com/forums/topic/17490-follow-button-effect/?tab=comments#comment-81107
2960	// =======================================================================================
2961	
2962	if ($("body").not(".is-mobile").hasClass("tt-magic-cursor")) {
2963		if ($(window).width() > 1024) {
2964			$(".magnetic-item").wrap('<div class="magnetic-wrap"></div>');
2965			
2966			if ($("a.magnetic-item").length) {
2967				$("a.magnetic-item").addClass("not-hide-cursor");
2968			}
2969
2970			var $mouse = { x: 0, y: 0 }; // Cursor position
2971			var $pos = { x: 0, y: 0 }; // Cursor position
2972			var $ratio = 0.15; // delay follow cursor
2973			var $active = false;
2974			var $ball = $("#ball");
2975
2976			var $ballWidth = 36; // Ball default width
2977			var $ballHeight = 36; // Ball default height
2978			var $ballOpacity = 0.5; // Ball default opacity
2979			var $ballBorderWidth = 2; // Ball default border width
2980
2981			gsap.set($ball, {  // scale from middle and style ball
2982				xPercent: -50, 
2983				yPercent: -50, 
2984				width: $ballWidth,
2985				height: $ballHeight,
2986				borderWidth: $ballBorderWidth, 
2987				opacity: $ballOpacity 
2988			});
2989
2990			document.addEventListener("mousemove", mouseMove);
2991
2992			function mouseMove(e) {
2993				$mouse.x = e.clientX;
2994				$mouse.y = e.clientY;
2995			}
2996
2997			gsap.ticker.add(updatePosition);
2998
2999			function updatePosition() {
3000				if (!$active) {
3001					$pos.x += ($mouse.x - $pos.x) * $ratio;
3002					$pos.y += ($mouse.y - $pos.y) * $ratio;
3003
3004					gsap.set($ball, { x: $pos.x, y: $pos.y });
3005				}
3006			}
3007
3008			$(".magnetic-wrap").mousemove(function(e) {
3009				parallaxCursor(e, this, 2); // magnetic ball = low number is more attractive
3010				callParallax(e, this);
3011			});
3012
3013			function callParallax(e, parent) {
3014				parallaxIt(e, parent, parent.querySelector(".magnetic-item"), 25); // magnetic area = higher number is more attractive
3015			}
3016
3017			function parallaxIt(e, parent, target, movement) {
3018				var boundingRect = parent.getBoundingClientRect();
3019				var relX = e.clientX - boundingRect.left;
3020				var relY = e.clientY - boundingRect.top;
3021
3022				gsap.to(target, {
3023					duration: 0.3, 
3024					x: ((relX - boundingRect.width / 2) / boundingRect.width) * movement,
3025					y: ((relY - boundingRect.height / 2) / boundingRect.height) * movement,
3026					ease: Power2.easeOut
3027				});
3028			}
3029
3030			function parallaxCursor(e, parent, movement) {
3031				var rect = parent.getBoundingClientRect();
3032				var relX = e.clientX - rect.left;
3033				var relY = e.clientY - rect.top;
3034				$pos.x = rect.left + rect.width / 2 + (relX - rect.width / 2) / movement;
3035				$pos.y = rect.top + rect.height / 2 + (relY - rect.height / 2) / movement;
3036				gsap.to($ball, {duration: 0.3, x: $pos.x, y: $pos.y });
3037			}
3038
3039
3040			// Magic cursor behavior
3041			// ======================
3042
3043			// Magnetic item hover.
3044			$(".magnetic-wrap").on("mouseenter mouseover", function(e) {
3045				$ball.addClass("magnetic-active");
3046				gsap.to($ball, { duration: 0.3, width: 70, height: 70, opacity: 1 });
3047				$active = true;
3048			}).on("mouseleave", function(e) {
3049				$ball.removeClass("magnetic-active");
3050				gsap.to($ball, { duration: 0.3, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3051				gsap.to(this.querySelector(".magnetic-item"), { duration: 0.3, x: 0, y: 0, clearProps:"all" });
3052				$active = false;
3053			});
3054
3055			// Alternative cursor style on hover.
3056			$(".cursor-alter, .tt-main-menu-list > li > a, .tt-main-menu-list > li > .tt-submenu-trigger > a")
3057			.not(".magnetic-item") // omit from selection.
3058			.on("mouseenter", function() {
3059				gsap.to($ball, {
3060					duration: 0.3, 
3061					borderWidth: 0, 
3062					opacity: 0.2, 
3063					backgroundColor: jQuery("#ball").data("cursor-alter-color"),
3064					width: "100px", 
3065					height: "100px", 
3066				});
3067			}).on("mouseleave", function() {
3068				gsap.to($ball, {
3069					duration: 0.3, 
3070					borderWidth: $ballBorderWidth, 
3071					opacity: $ballOpacity, 
3072					backgroundColor: "transparent", 
3073					width: $ballWidth, 
3074					height: $ballHeight, 
3075					clearProps:"backgroundColor" 
3076				});
3077			});
3078
3079			// Overlay menu caret hover.
3080			$(".tt-ol-submenu-caret-wrap .magnetic-wrap").on("mouseenter", function() {
3081				gsap.to($ball, { duration: 0.3, scale: 0.6, borderWidth: 3 });
3082			}).on("mouseleave", function() {
3083				gsap.to($ball, { duration: 0.3, scale: 1, borderWidth: $ballBorderWidth });
3084			});
3085
3086			// Cursor view on hover (data attribute "data-cursor="...").
3087			$("[data-cursor]").each(function() {
3088				$(this).on("mouseenter", function() {
3089					$ball.addClass("ball-view").append('<div class="ball-view-inner"></div>');
3090					$(".ball-view-inner").append($(this).attr("data-cursor"));
3091					gsap.to($ball, { duration: 0.3, yPercent: -75, width: 95, height: 95, opacity: 1, borderWidth: 0 });
3092					gsap.to(".ball-view-inner", { duration: 0.3, scale: 1, autoAlpha: 1 });
3093				}).on("mouseleave", function() {
3094					gsap.to($ball, { duration: 0.3, yPercent: -50, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity, borderWidth: $ballBorderWidth });
3095					$ball.removeClass("ball-view").find(".ball-view-inner").remove();
3096				});
3097				$(this).addClass("not-hide-cursor");
3098			});
3099
3100			// Cursor drag on hover (class "cursor-drag"). For Swiper sliders.
3101			$(".swiper").each(function() {
3102				if ($(this).parent().attr("data-simulate-touch") == "true") {
3103					if ($(this).parent().hasClass("cursor-drag")) {
3104						$(this).on("mouseenter", function() {
3105							$ball.append('<div class="ball-drag"></div>');
3106							gsap.to($ball, { duration: 0.3, width: 60, height: 60, opacity: 1 });
3107						}).on("mouseleave", function() {
3108							$ball.find(".ball-drag").remove();
3109							gsap.to($ball, { duration: 0.3, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3110						});
3111						$(this).addClass("not-hide-cursor");
3112
3113						// Ignore "data-cursor" on hover.
3114						$(this).find("[data-cursor]").on("mouseenter mouseover", function() {
3115							$ball.find(".ball-drag").remove();
3116							return false;
3117						}).on("mouseleave", function() {
3118							$ball.append('<div class="ball-drag"></div>');
3119							gsap.to($ball, { duration: 0.3, width: 60, height: 60, opacity: 1 });
3120						});
3121					}
3122				}
3123			});
3124			
3125			// Cursor drag on mouse down / click and hold effect (class "cursor-drag-mouse-down"). For Swiper sliders.
3126			$(".swiper").each(function() {
3127				if ($(this).parent().attr("data-simulate-touch") == "true") {
3128					if ($(this).parent().hasClass("cursor-drag-mouse-down")) {
3129						$(this).on("mousedown pointerdown", function(e) {
3130							if (e.which === 1) { // Affects the left mouse button only!
3131								gsap.to($ball, { duration: 0.2, width: 60, height: 60, opacity: 1 });
3132								$ball.append('<div class="ball-drag"></div>');
3133							}
3134						}).on("mouseup pointerup", function() {
3135							$ball.find(".ball-drag").remove();
3136							if ($(this).find("[data-cursor]:hover").length) {
3137							} else {
3138								gsap.to($ball, { duration: 0.2, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3139							}
3140						}).on("mouseleave", function() {
3141							$ball.find(".ball-drag").remove();
3142							gsap.to($ball, { duration: 0.2, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3143						});
3144
3145						// Ignore "data-cursor" on mousedown.
3146						$(this).find("[data-cursor]").on("mousedown pointerdown", function() {
3147							return false;
3148						});
3149
3150						// Ignore "data-cursor" on hover.
3151						$(this).find("[data-cursor]").on("mouseenter mouseover", function() {
3152							$ball.find(".ball-drag").remove();
3153							return false;
3154						});
3155					}
3156				}
3157			});
3158
3159			// Cursor close on hover.
3160			$(".cursor-close").each(function() {
3161				$(this).addClass("ball-close-enabled");
3162				$(this).on("mouseenter", function() {
3163					$ball.addClass("ball-close-enabled");
3164					$ball.append('<div class="ball-close"></div>');
3165					gsap.to($ball, { duration: 0.3, yPercent: -75, width: 80, height: 80, opacity: 1 });
3166					gsap.from(".ball-close", { duration: 0.3, scale: 0, autoAlpha: 0 });
3167				}).on("mouseleave click", function() {
3168					$ball.removeClass("ball-close-enabled");
3169					gsap.to($ball, { duration: 0.3, yPercent: -50, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3170					$ball.find(".ball-close").remove();
3171				});
3172
3173				// Hover on "cursor-close" inner elements.
3174				$(".cursor-close a, .cursor-close button, .cursor-close .tt-btn, .cursor-close .hide-cursor")
3175				.not(".not-hide-cursor") // omit from selection (class "not-hide-cursor" is for global use).
3176				.on("mouseenter", function() {
3177					$ball.removeClass("ball-close-enabled");
3178				}).on("mouseleave", function() {
3179					$ball.addClass("ball-close-enabled");
3180				});
3181			});
3182
3183			// Blog interactive title link hover.
3184			$(".blog-interactive-item").each(function() {
3185				var $biItem = $(this);
3186				if ($biItem.find(".bi-item-image").length) {
3187					$biItem.find(".bi-item-title a").on("mouseenter mouseover", function() {
3188						$("#magic-cursor").addClass("blog-interactive-hover-on");
3189						$biItem.find(".bi-item-image").appendTo($ball);
3190						gsap.to($ball, { duration: 0.3, width: "20vw", height: "20vw", opacity: 1 });
3191					}).on("mouseleave", function() {
3192						$("#magic-cursor").removeClass("blog-interactive-hover-on");
3193						$ball.find(".bi-item-image").appendTo($biItem); 
3194						gsap.to($ball, { duration: 0.3, width: $ballWidth, height: $ballHeight, opacity: $ballOpacity });
3195					});
3196					$biItem.find(".bi-item-title a").addClass("not-hide-cursor");
3197					$biItem.addClass("bi-item-image-on");
3198				}
3199			});
3200
3201			
3202			// Show/hide magic cursor
3203			// =======================
3204
3205			// Hide on hover.
3206			$("a, button, .tt-btn, .tt-form-control, .tt-form-radio, .tt-form-check, .hide-cursor") // class "hide-cursor" is for global use.
3207			.not(".not-hide-cursor") // omit from selection (class "not-hide-cursor" is for global use).
3208			.not(".cursor-alter") // omit from selection
3209			.not(".tt-main-menu-list > li > a") // omit from selection
3210			.not(".tt-main-menu-list > li > .tt-submenu-trigger > a") // omit from selection
3211			.on("mouseenter", function() {
3212				gsap.to($ball, { duration: 0.3, scale: 0, opacity: 0 });
3213			}).on("mouseleave", function() {
3214				gsap.to($ball, { duration: 0.3, scale: 1, opacity: $ballOpacity });
3215			});
3216
3217			// Hide on click.
3218			$("a")
3219				.not('[target="_blank"]') // omit from selection.
3220				.not('[href^="#"]') // omit from selection.
3221				.not('[href^="mailto"]') // omit from selection.
3222				.not('[href^="tel"]') // omit from selection.
3223				.not(".lg-trigger") // omit from selection.
3224				.not(".tt-btn-disabled") // omit from selection.
3225				.not(".comment-reply-link") // omit from selection
3226				.not("#cancel-comment-reply-link") // omit from selection
3227				.not(".elementor-gallery-item") // omit from selection
3228				.not(".elementor-widget-image a") // omit from selection
3229				.not(".elementor-widget-image-gallery a") // omit from selection
3230				.not(".eae-gallery-item-inner a") // omit from selection
3231				.not(".elementor-toggle-title") // omit from selection
3232				.not(".elementor-accordion-title") // omit from selection
3233				.not(".exad-fg-icons a") // omit from selection
3234				.not(".lfb_btn-next") // omit from selection
3235				.not(".linkPrevious") // omit from selection
3236				.not(".lfb_btnNextContainer a.btn") // omit from selection
3237				.not(".lg-share") // omit from selection
3238				.on('click', function() {
3239					gsap.to($ball, { duration: 0.3, scale: 1.3, autoAlpha: 0 });
3240			});
3241
3242			// Show/hide on document leave/enter.
3243			$(document).on("mouseleave", function() {
3244				gsap.to("#magic-cursor", { duration: 0.3, autoAlpha: 0 });
3245			}).on("mouseenter", function() {
3246				gsap.to("#magic-cursor", {duration: 0.3, autoAlpha: 1 });
3247			});
3248
3249			// Show as the mouse moves.
3250			$(document).mousemove(function() {
3251				gsap.to("#magic-cursor", {duration: 0.3, autoAlpha: 1 });
3252			});
3253		}
3254	}
3255})(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.