Hey there,
im pretty new to GSAP and ScrollTrigger but i tried to animate the Columns in the video to scroll horizontally by scrolling down. Im facing a weird issue while scrolling down, the Pin jumps on start and end as you can see in the Video. I did not add any margin to the Sections.
Below you can find my JS Code.
Thank you!
$(window).on("load resize", function (e) {
events()
});
function events() {
$('.events').each(function () {
let $this = $(this),
wrapper = $this.children('.events-wrapper'),
height = $(window).height(),
events = $(this).find('.event');
$(wrapper).css("min-height", height);
let duration = 4,
sections = gsap.utils.toArray(events),
sectionIncrement = duration / (sections.length - 1),
event = gsap.timeline({
scrollTrigger: {
trigger: wrapper,
pin: true,
scrub: 0.3,
start: "top",
end: "+=1000",
}
});
event.to(sections, {
xPercent: -50 * (sections.length - 1),
duration: duration,
ease: "none"
})
.to({}, { duration: 0.5 });
})
}
gsap_problem.mp4