/ Published in: jQuery
Example in 'jQuery enlightenment'
Simple way to jump smoothly down the page without the use of a plugin.
Simple way to jump smoothly down the page without the use of a plugin.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * HTML setup as a list of anchors set vertically down the page */ //Click an anchor $("a").click(function(e){ //Animate the html and body $("html, body").animate({ //Set the CSS property scrollTop to the next anchors top value scrollTop: $(this).parent('li').next().find("a").offset().top }, 1000);//1 second scroll (add some easing for a smoother look) return false; });