Jump to content
Search Community

Scrolltrigger not restart the video

antonio michelon test
Moderator Tag

Recommended Posts

hey guys

I'm starting on Gasp, I'm trying to use the scrollingtrigger to control a video according to the page's scroll, with the examples I found here on the site I managed to make play and pause work, but I still couldn't make the video start from the beginning when I go back to the video, in the code I changed the pause option to restart, but nothing has changed in the behavior of the video, below is the code with the restart.
grateful for the help!

 

  
  let videoElem = videoDiv.querySelector('video')
  ScrollTrigger.create({
    trigger: videoElem,
    start: 'top 80%',
    end: 'top 20%',
    markers: true,
    onEnter: () => videoElem.play(),
    onEnterBack: () => videoElem.play(),
    onLeave: () => videoElem.restart(),
    onLeaveBack: () => videoElem.restart(),

See the Pen eYPLmzv by Antonio-Miguel-Michelon (@Antonio-Miguel-Michelon) on CodePen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...