Both solutions are perfect, only if I add
smoother.effects (). forEach (trigger => trigger.kill ());
const createFadeTweens = () => {
.....
};
mm.add("(min-width: 800px)", () => {
let skewSetter = gsap.quickTo(".js-skew", "skewY"), // fast
clamp = gsap.utils.clamp(-20, 20); // don't let the skew go beyond 20 degrees.
smoother = ScrollSmoother.create({
wrapper: "#smooth-wrapper",
content: "#smooth-content",
smooth: 2,
normalizeScroll: true,
ignoreMobileResize: true,
effects: true,
onUpdate: (self) => skewSetter(clamp(self.getVelocity() / -150)),
onStop: () => skewSetter(0)
});
createFadeTweens();
ScrollHoriz();
/*return () => smoother.kill();*/
});
mm.add("(max-width: 799px)", () => {
createFadeTweens();
smoother.effects().forEach(trigger => trigger.kill());
});
disables not only effects but also
smoother = ScrollSmoother.create({
....
smooth: 2,
....
});
In practice we have the exact same solution with:
return () => smoother.kill ();
Is it possible not to delete the "smooth: 2" option?
Thanks