Jump to content

Internal links


MSousa
 Share

Recommended Posts

If you're doing any kind of animation at all then you need to use Javascript's setTimeout or setInterval functions, which let you schedule code to run later. For a sliding effect, you would use it to run a function say every 10 milliseconds or so, and scroll down just a little bit (a few pixels, depending on how fast you want the scroll to be). It would check the current scroll position and the destination position to figure out when to stop the animation. A more advanced version would slow the scroll speed down as it approaches the destination, which is called easing. There are plenty of frameworks that already implement things like that, such as jQuery.

  • 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
 Share

×
×
  • Create New...