| 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 : /home/revivere/public_html/wp-content/themes/astra-child-theme/ |
Upload File : |
(function ($) {
'use strict';
let animationsInitialized = false;
function initAnimations() {
if (animationsInitialized) return;
animationsInitialized = true;
if (typeof gsap === 'undefined') return;
console.log('Initializing animations...');
// Ensure visibility
gsap.set('.fade-heading, .timeline-box .timeline-item, .grid-card', {
opacity: 1,
visibility: 'visible'
});
/* ===============================
1. Fade Heading
=============================== */
if ($('.fade-heading').length && window.ScrollTrigger) {
gsap.utils.toArray('.fade-heading').forEach(heading => {
gsap.set(heading, { opacity: 0, y: 30 });
gsap.to(heading, {
opacity: 1,
y: 0,
duration: 1,
scrollTrigger: {
trigger: heading,
start: 'top 85%',
end: 'top 35%',
scrub: 1
}
});
});
}
/* ===============================
2. Timeline Box
=============================== */
if ($('.timeline-box').length && window.ScrollTrigger) {
gsap.utils.toArray('.timeline-box').forEach(box => {
const items = box.querySelectorAll('.timeline-item');
if (!items.length) return;
gsap.set(items, { opacity: 0, y: 30 });
gsap.to(items, {
opacity: 1,
y: 0,
stagger: 0.2,
duration: 0.8,
scrollTrigger: {
trigger: box,
start: 'top 80%',
end: 'bottom 30%',
scrub: 1
}
});
});
}
/* ===============================
3. Hover Scale
=============================== */
$('.hover-scale').hover(
function () {
gsap.to(this, {
scale: 1.1,
rotation: 5,
duration: 0.3,
overwrite: true
});
},
function () {
gsap.to(this, {
scale: 1,
rotation: 0,
duration: 0.3,
overwrite: true
});
}
);
/* ===============================
4. Weight Counter
=============================== */
if ($('.weight-counter').length && window.ScrollTrigger) {
gsap.utils.toArray('.weight-counter').forEach(counter => {
const targetNumber = parseInt($(counter).data('target')) || 100;
counter.innerText = '0';
ScrollTrigger.create({
trigger: counter,
start: 'top 85%',
once: true,
onEnter: () => {
gsap.to(counter, {
innerText: targetNumber,
duration: 2,
snap: { innerText: 1 },
ease: 'power2.out',
onUpdate: function () {
counter.innerText = Math.floor(this.targets()[0].innerText);
}
});
}
});
});
}
/* ===============================
5. Split Text
=============================== */
if ($('.split-text').length && window.SplitText && window.ScrollTrigger) {
gsap.utils.toArray('.split-text').forEach(text => {
const split = new SplitText(text, { type: 'chars,words,lines' });
gsap.set(split.chars, { opacity: 0, y: 30, rotationX: -45 });
gsap.to(split.chars, {
opacity: 1,
y: 0,
rotationX: 0,
stagger: 0.02,
duration: 0.8,
scrollTrigger: {
trigger: text,
start: 'top 85%',
scrub: 1
}
});
});
}
/* ===============================
6. Scramble Text
=============================== */
if ($('.scramble-text').length && window.ScrambleTextPlugin && window.ScrollTrigger) {
gsap.utils.toArray('.scramble-text').forEach(text => {
const originalText = text.innerText;
ScrollTrigger.create({
trigger: text,
start: 'top 85%',
once: true,
onEnter: () => {
gsap.to(text, {
duration: 2,
scrambleText: {
text: originalText,
chars: 'lowerCase',
revealDelay: 0.5
}
});
}
});
});
}
/* ===============================
7. Draggable
=============================== */
if ($('.draggable').length && window.Draggable) {
gsap.utils.toArray('.draggable').forEach(element => {
Draggable.create(element, {
type: 'x,y',
bounds: 'body',
inertia: true
});
});
}
/* ===============================
8. Rotate Hover
=============================== */
$('.rotate-hover').hover(
function () {
gsap.to(this, { rotation: 10, scale: 1.1, duration: 0.3 });
},
function () {
gsap.to(this, { rotation: 0, scale: 1, duration: 0.3 });
}
);
/* ===============================
9. Floating Elements
=============================== */
if ($('.float-element').length) {
gsap.utils.toArray('.float-element').forEach(element => {
gsap.to(element, {
y: 20,
rotation: 2,
duration: 2,
yoyo: true,
repeat: -1,
ease: 'sine.inOut'
});
});
}
/* ===============================
Refresh ScrollTrigger
=============================== */
if (window.ScrollTrigger) {
setTimeout(() => {
ScrollTrigger.refresh();
}, 500);
}
console.log('All animations initialized');
}
function checkGSAP() {
if (typeof gsap === 'undefined') {
setTimeout(checkGSAP, 100);
return;
}
if (gsap.registerPlugin) {
const plugins = [
window.ScrollTrigger,
window.ScrollToPlugin,
window.Draggable,
window.SplitText,
window.ScrambleTextPlugin
].filter(Boolean);
gsap.registerPlugin(...plugins);
}
initAnimations();
}
// Normal load
$(document).ready(function () {
checkGSAP();
});
// Elementor safe hook
$(window).on('elementor/frontend/init', function () {
elementorFrontend.hooks.addAction(
'frontend/element_ready/global',
function () {
animationsInitialized = false;
setTimeout(checkGSAP, 300);
}
);
});
})(jQuery);