MSousa 0 Posted January 9, 2014 Report Share Posted January 9, 2014 In internal links such that: down a> a> how can I slide the screen down?the intention is to slide and not jump Quote Link to post Share on other sites
justsomeguy 1,135 Posted January 9, 2014 Report Share Posted January 9, 2014 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. 1 Quote Link to post Share on other sites
MSousa 0 Posted January 10, 2014 Author Report Share Posted January 10, 2014 Can you show me this in Javascript example? Quote Link to post Share on other sites
justsomeguy 1,135 Posted January 10, 2014 Report Share Posted January 10, 2014 There's a tutorial that describes the theory here:http://www.schillmania.com/content/projects/javascript-animation-1/ Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.