| Server IP : 198.38.94.13 / Your IP : 216.73.217.33 Web Server : Apache System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : revivere ( 1140) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/wp-content/themes/astra-child-theme/ |
Upload File : |
jQuery(document).ready(function($) {
'use strict';
// Initialize Lenis smooth scrolling
function initLenis() {
if (typeof Lenis === 'undefined') {
console.log('Waiting for Lenis to load...');
setTimeout(initLenis, 100);
return;
}
console.log('Initializing Lenis smooth scrolling...');
// Initialize Lenis
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), // https://www.desmos.com/calculator/brs54l4xou
direction: 'vertical',
gestureDirection: 'vertical',
smooth: true,
smoothTouch: false,
touchMultiplier: 2,
infinite: false,
});
// Connect Lenis to GSAP's ticker
function raf(time) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
// Update GSAP ScrollTrigger on scroll
lenis.on('scroll', ScrollTrigger.update);
// Add lenis to global scope
window.lenis = lenis;
// Handle anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', (e) => {
const href = anchor.getAttribute('href');
if (href === '#') return;
const target = document.querySelector(href);
if (target) {
e.preventDefault();
lenis.scrollTo(target, {
offset: 0,
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
});
}
});
});
console.log('Lenis smooth scrolling initialized');
// Refresh ScrollTrigger after Lenis is set up
setTimeout(() => {
ScrollTrigger.refresh();
}, 500);
}
// Start initialization
setTimeout(initLenis, 500);
// Handle Elementor popups
if (typeof elementorFrontend !== 'undefined') {
elementorFrontend.hooks.addAction('frontend/element_ready/global', function() {
setTimeout(() => {
if (window.lenis) {
window.lenis.resize();
ScrollTrigger.refresh();
}
}, 500);
});
}
// Pause smooth scroll during Elementor popup interactions
$(document).on('elementor/popup/show', function() {
if (window.lenis) {
window.lenis.stop();
}
});
$(document).on('elementor/popup/hide', function() {
if (window.lenis) {
window.lenis.start();
setTimeout(() => {
ScrollTrigger.refresh();
}, 300);
}
});
// Refresh on window resize
let resizeTimer;
$(window).on('resize', function() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
if (window.lenis) {
window.lenis.resize();
ScrollTrigger.refresh();
}
}, 250);
});
});