简体   繁体   中英

Smooth scrolling with jquery

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

$('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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM