Hey guys,
Loving the ScrollTrigger plugin
I'm building a horizontal scroll site, however at a certain point I would like to switch to vertical depending on the viewport.
Currently when the condition is met I try to kill the ScrollTrigger like this:
ScrollTrigger.getById('id').kill();
And then re-initialise the whole timeline including ScrollTrigger like this:
this.tl = gsap.timeline({
scrollTrigger: {
id: `id`,
trigger: this.$refs.wrapperRight,
horizontal: this.isHorizontalScroll,
start: "10% 90%",
end: "100% 0%",
scroller: this.containerEl,
markers: true,
toggleActions: "play reverse play reverse"
}
});
This works if the "this.isHorizontalScroll" value stays the same. However if it changes, the markers that determine the start and stop position of the trigger scrolling along with the container, and i'm unable to get it to work.
I can make a codepen demo if needed however maybe there is another way to kill the ScrollTrigger as it looks like some values are not cleared.
Thanks in advance,
Cheers,
M