jQuery animate scroll

后端 未结 5 1017
名媛妹妹
名媛妹妹 2020-12-02 10:21

I\'m not sure how to call the effect, but can someone point me into a library that would help me do the same effect as this website?

http://www.makr.com

Basi

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 10:44

    var page_url = windws.location.href;
    var page_id = page_url.substring(page_url.lastIndexOf("#") + 1);
    if (page_id == "") {
        $("html, body").animate({
            scrollTop: $("#scroll-" + page_id).offset().top
        }, 2000)
    } else if (page_id == "") {
        $("html, body").animate({
            scrollTop: $("#scroll-" + page_id).offset().top
        }, 2000)
    }
    

    });

提交回复
热议问题