Jump to content

Internal links

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...