Simple JQuery page scroll to an anchor
Drupal.behaviors.scrollMenu = {
attach: function(context, settings) {
$('a[href*=#]:not([href=#])').click(function(event) {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { // not required
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').stop().animate({
scrollTop: target.offset().top
}, 800);
event.preventDefault();
}
}
});
}
};