1// Animaciones GSAP globales del tema 2// - Smooth scroll básico para anclas internas 3// - Aparición suave de bloques .premios-rankia-section-content 4 5document.addEventListener('DOMContentLoaded', () => { 6 if (typeof gsap === 'undefined') { 7 return; 8 } 9 10 if (typeof ScrollTrigger !== 'undefined') { 11 gsap.registerPlugin(ScrollTrigger); 12 } 13 14 // Smooth scroll nativo (sin plugins extra) para anclas con ID 15 document.addEventListener('click', (event) => { 16 const link = event.target.closest('a[href^="#"]'); 17 if (!link) return; 18 19 const href = link.getAttribute('href'); 20 if (!href || href === '#') return; 21 22 const target = document.querySelector(href); 23 if (!target) return; 24 25 event.preventDefault(); 26 27 const headerEl = document.querySelector('.premios-rankia-header'); 28 const headerOffset = headerEl ? headerEl.getBoundingClientRect().height : 80; 29 30 const rect = target.getBoundingClientRect(); 31 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 32 const targetY = rect.top + scrollTop - headerOffset; 33 34 window.scrollTo({ 35 top: targetY, 36 behavior: 'smooth', 37 }); 38 }); 39 40 // Animaciones de entrada para bloques de Premios Rankia 41 const premiosBlocks = document.querySelectorAll('.premios-rankia-section-content'); 42 if (premiosBlocks.length && typeof ScrollTrigger !== 'undefined') { 43 premiosBlocks.forEach((block, index) => { 44 gsap.from(block, { 45 opacity: 0, 46 y: 40, 47 duration: 0.9, 48 ease: 'power2.out', 49 delay: index * 0.05, 50 scrollTrigger: { 51 trigger: block, 52 start: 'top 80%', 53 toggleActions: 'play none none reverse', 54 }, 55 }); 56 }); 57 } 58}); 59 60
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.