Picture of Chris Gillison
Adding easing to Adapt.scrollTo()
by Chris Gillison - Thursday, 23 February 2017, 7:01 PM
 

Hello all,

I'm not really a coder, but what I'm trying to do is add some easing to the scrollTo() function in Trickle. Whatever I try doesn't seem to make any difference!

On line 103 of adapt-contrib-trickle.js I've got the following:

Adapt.scrollTo("." + scrollToId, { duration: duration }, { easing: 'easeInOutCirc' } );

Can anyone with better JS skills than me (not hard!) advise me as to what's wrong with that and correct it?

Many thanks,

Chris

Picture of Matt Leathes
Re: Adding easing to Adapt.scrollTo()
by Matt Leathes - Thursday, 23 February 2017, 7:58 PM
 

I think you just need to add your easing setting as an additional property of the second argument (as opposed to adding it via a third argument), e.g.:

Adapt.scrollTo("." + scrollToId, { duration: duration, easing: 'easeInOutCirc' } );

Picture of Chris Gillison
Re: Adding easing to Adapt.scrollTo()
by Chris Gillison - Monday, 27 February 2017, 11:44 AM
 

Thanks Matt. That doesn't appear to make any difference I'm afraid.

Picture of Matt Leathes
Re: Adding easing to Adapt.scrollTo()
by Matt Leathes - Monday, 27 February 2017, 4:28 PM
 

Have you registered an easing function as easeInOutCirc? If you haven't, it won't work and you'll get an error in the Console.

There's a load of predefined ones here if that helps.

It's actually jquery.scrollTo that is handling the scrolling so worth having a look through the documentation there.