$('class_блока').scrollingToElement();
$.fn.scrollingToElement = function(options) {
var elem = this;
options = $.extend({
selector: 'a[href^="#"]',
offsetTop: 0,
speed: 300
}, options);
return this.each(function() {
elem.find(options.selector).click(function() {
var el = $(this).attr('href');
$('body, html').animate({
scrollTop: $(el).offset().top - options.offsetTop
}, options.speed);
return false;
});
});
}