I have this code which should scrollTo the selected scene and it should be animated:
$('.scroll-trigger').click( function(e) {
e.preventDefault();
controller.scrollTo(function(target) {
TweenMax.to(window, 0.5, {
scrollTo : {
y : target, // scroll position of the target along y axis
autoKill : true // allows user to kill scroll action smoothly
},
ease : Cubic.easeInOut
});
});
controller.scrollTo(".edge-to-edge-image-wrapper:first-child",5000);
});
That does nothing, but just going to the scene without the animation works fine:
$('.scroll-trigger').click( function(e) {
e.preventDefault();
controller.scrollTo(".edge-to-edge-image-wrapper:first-child",5000);
});
@johnwbaxter I know this is old, but incase anyone stumbles across this, you need to include the ScrollTo plugin
eg. import ScrollToPlugin from "gsap/ScrollToPlugin"
Following code also work for scroll
controller.scrollTo(function(newScrollPos) {
$("html, body").animate({
scrollTop: newScrollPos
});
});
controller.scrollTo(100);
Close this issue?
Most helpful comment
@johnwbaxter I know this is old, but incase anyone stumbles across this, you need to include the ScrollTo plugin
eg.
import ScrollToPlugin from "gsap/ScrollToPlugin"