Jump to content
Search Community

Making my slider pause between slides

TDWebDev test
Moderator Tag

Recommended Posts

Hi there,

 

I've created a slider using ScrollTrigger and i was wanting to know how i'd go about forcing the slides to have a little delay once they reach the center, Maybe like 1 or 2 seconds or so, Hopefully this makes sense, You should see what i mean from the demo, Currently it just slides constantly from the second it pins to the second its over

 

Thanks

See the Pen MWxrxZy by Thomas-Deer-the-animator (@Thomas-Deer-the-animator) on CodePen

Link to comment
Share on other sites

Sorry after playing around and trying to merge the demo and my code together and get the background colours working i have kinda come up with this. But i can't seem to work out how to get the background to work correctly on reverse and how i would ensure the image sits for a little while before scrolling off the screen and the next slide coming into view, 

An updated codepen link can be found here 

See the Pen OJqQjzJ by Thomas-Deer-the-animator (@Thomas-Deer-the-animator) on CodePen

 

Appreciate any help with this.

Link to comment
Share on other sites

Hi,

 

Just use the position parameter to increase the amount of time between both animations on the image:

.to(card(".scroll-through"), {
  yPercent: 0,
  opacity: 1,
  ease: "power2.out",
  duration: 4
})
.to(card(".scroll-through"), {
  yPercent: 200,
  opacity: 0,
  ease: "power2.out",
  duration: 1
}, "+=1")

Finally is better to use a call() method instead of the onStart callback to change the background color.

 

Here is a fork of your demo:

See the Pen qBvxPyE by GreenSock (@GreenSock) on CodePen

 

Finally @Carl has a great video showing how to create a background change based on scrolling:

 

Hopefully this helps.

Happy Tweening!

  • Like 1
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...