The jQuery fragment scroll plugin replaces the default fragment link behavior with a scroll animation. The plugin only works for descendants of the given element(s). Check the demo for more information.
<!doctype html> <html> <body> <div id="nav"> <p><a href="#fragment">Content</a></p> </div> <div id="fragment"> <p>Footer</p> </div> </body> </html>
$(window).load(function() {
$('body').fragmentScroll();
});
$('body').fragmentScroll({
// The frame that will scroll if the content overflows the elements box. (body for webkit browsers)
frame: 'html, body',
// The offset from the top of the element.
offset: 0,
// The animation time in microseconds.
speed: 1000,
// Animation effect. (http://www.easings.net)
easing: 'swing'
// Enable fragment in URL.
enableFragment: false,
// Enable animation chain. The browser will execute all the events in stead of ignoring event during animation.
enableAnimationChain: false,
// Call function on start.
onStart: function() {},
// Call function on complete.
onComplete: function() {}
});