问题
I know there are questions about smooth scrolling on SF already but I am unable to find what I want. Already used improved smooth scroll script but it's the one on this website http://michaelacevedo.com I want to achieve. When you click on a link then it starts off real slow and then speedy animation takes you to the desired section. It's really different than other smooth scrolls. Can anyone help implement this effect and explain what's the code doing. Thanks
回答1:
$('a').click(function(){
var top = $('body').find($(this).attr('href')).offset().top;
$('html, body').animate({
scrollTop: top
},500, 'easeOutExpo');
return false;
});
Then select the easing you want https://matthewlein.com/experiments/easing.html
来源:https://stackoverflow.com/questions/35722835/smooth-scrolling-with-jquery