Как добавить анимацию (эффект медленной прокрутки) к этому коду. В настоящее время его просто переход к следующему разделу, когда я прокручиваю вниз
window.onload=function(){
//initialize
var winHeight = $(window).height(),
pages = $('.page'),
navLinks = $('#menu-nav a'),
currentPage = 0;
$('html, body').animate({ scrollTop: 0}, 0);
$(window).on('mousewheel DOMMouseScroll', function(e){
var direction = 'down',
$th = $(this),
currentPageOffset = currentPage * winHeight;
if (e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) {
direction = 'up';
}
if(direction == 'down' && currentPage <= pages.length - 2){
$th.scrollTop(currentPageOffset + winHeight);
currentPage++;
} else if(direction == 'up' && currentPage > 0) {
$th.scrollTop(currentPageOffset - winHeight);
currentPage--;
}
});
navLinks.each(function(index){
$(this).on('click', function(){
navLinks.parent().removeClass('current');
$(this).parent().addClass('current');
currentPage = index;
});
});
}