MSousa Posted January 9, 2014 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2014 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 Link to comment Share on other sites More sharing options...
MSousa Posted January 10, 2014 Author Share Posted January 10, 2014 Can you show me this in Javascript example? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 10, 2014 Share Posted January 10, 2014 There's a tutorial that describes the theory here:http://www.schillmania.com/content/projects/javascript-animation-1/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now