Javi fixed the scrolll!!!!
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ekaropolus 2025-07-19 18:49:48 -06:00
parent a4acfcaded
commit 03bc35afe1

View File

@ -647,8 +647,85 @@ $(window).on('load',function (){
gsap.set(sections, {xPercent: 0}); gsap.set(sections, {xPercent: 0});
// menu navigation // scroll.js
// superbasic menu nav test // scroll.js
$(document).on('click', '.js-scroll-link', function(event) {
event.preventDefault();
const linkIdx = parseInt($(this).data('link'), 10);
const targetY = linkData[linkIdx];
const scrollMap = [ 0, 0, 0.25, 0.5, 0.75, 1, 1 ];
const lastMap = [ 0, 0, 0, 0, 0, 0, 1 ];
console.log('▶ CLICK', linkIdx, '→ scroll to', targetY);
if (blockNavigation || skipMode) {
console.log(' 🚫 navigation locked (blockNavigation=', blockNavigation, 'skipMode=', skipMode, ')');
return;
}
// lock UI & fade out
skipMode = true;
$('.header__menu').addClass('blocked');
gsap.to('.home-page', { duration: 0.4, autoAlpha: 0 });
console.log(' → fading out');
setTimeout(() => {
console.log('▶ ANIMATION START');
console.log(' st.scroll(', targetY, ')');
st.scroll(targetY);
// master timelines
console.log(' tlScroll →', scrollMap[linkIdx]);
console.log(' tlScrollLast →', lastMap[linkIdx]);
tlScroll .progress(scrollMap[linkIdx]);
tlScrollLast.progress(lastMap[linkIdx]);
// sectionbysection reset (your original logic unrolled into a loop)
const sectionTGs = [
tl1, tl11, tl3, tl31,
tl4, tl41, tl5, tl51,
tl6, tl61, tl7
];
sectionTGs.forEach((tl, i) => {
const prog = (i < linkIdx) ? 1 : 0;
console.log(` section[${i}] → ${prog}`);
tl.progress(prog).pause();
});
// title timelines
const titleTGs = [ tlTitle2, tlTitle3, tlTitle4, tlTitle5, tlTitle6, tlTitle7 ];
titleTGs.forEach((ttl, i) => {
const prog = (i + 1 === linkIdx) ? 1 : 0;
console.log(` title[${i+2}] → ${prog}`);
ttl.progress(prog).pause();
});
// reposition
gsap.set(titles, { y: '100%' });
gsap.set(titles[linkIdx], { y: '0' });
gsap.set(sections, { xPercent: -100 * linkIdx, ease: 'none' }, 0);
console.log(' moved panels to', -100 * linkIdx, '%');
// menu UI
$('.header__menu li').removeClass('active')
.eq(linkIdx).addClass('active');
// fade back in
gsap.to('.home-page', {
duration: 0.5,
autoAlpha: 1,
onComplete() {
console.log('▶ ANIMATION END — unlocking');
skipMode = false;
$('.header__menu').removeClass('blocked');
}
});
}, 500);
});