JSPM

scroll-animate-to

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 33
    • Score
      100M100P100Q60275F
    • License MIT

    A light javascript library about scroll.

    Package Exports

    • scroll-animate-to

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scroll-animate-to) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    scroll-animate-to

    A light Javascript library to scroll to the position of element.

    Useage

    let header = document.getElementById('header')
    let scrollIns = new ScrollTo({
        target: header,
        animationFn: 'easeOut',
        duration: 1500
    })
    scrollIns.scroll()

    API

    new ScrollTo(option)

    • @param {Object} option
    • @param {HTMLElement} option.container default is "window"
    • @param {HTMLElement} option.target the element scroll to
    • @param {Function|string} option.animationFn "easeIn", "easeOut", "easeInOut", "linear". Default is "easeIn". And you can custom the function.
    • @param {Function} option.callback callback function
    • @param {number} option.duration the scroll cost time, default 1000(ms)
    • @param {string} option.axis "axis" would be "x" or "y". Default is "y"

    License

    MIT