JQUERY点击滚动到锚点

$(document).ready(function() {
    $("a.topLink").click(function() {
        $("html, body").animate({
            scrollTop: $($(this).attr("href")).offset().top + "px"
        }, {
            duration: 500,
            easing: "swing"
        });
        return false;
    });
});

 

posted @ 2014-09-04 13:53  jianjs  阅读(375)  评论(0编辑  收藏  举报