如何滚动全高的部分?

时间:2016-09-30 13:28:02

标签: javascript jquery jquery-ui fullpage.js

我有这个演示click

如何在全高度的demo中滚动部分,如fullPage.js? enter link description here

$(document).ready(function () {
    $(document).on("scroll", onScroll);

    //smoothscroll
    $('a[href^="#"]').on('click', function (e) {
        e.preventDefault();
        $(document).off("scroll");

        $('a').each(function () {
            $(this).removeClass('active');
        })
        $(this).addClass('active');

        var target = this.hash,
            menu = target;
        $target = $(target);
        $('html, body').stop().animate({
            'scrollTop': $target.offset().top+2
        }, 500, 'swing', function () {
            window.location.hash = target;
            $(document).on("scroll", onScroll);
        });
    });
});

0 个答案:

没有答案