#880·velocity

window.scrollTop

Author: incompletudeCreated Jun 25, 2018Updated Oct 12, 2020

Your system information

  • VelocityJS version: 2.0.5

I'm trying to animate the window.scrollTop using velocity v2. The code below doesn't work. Is there an interface to accomplish this?

    window.velocity(
        { scrollTop: "0px" },
        {
            duration: 800,
            delay: 500
        }
    );

I'm trying this, but it also doesn't work.

        var dummy = document.createElement("p");

        dummy.velocity(
            {
                tween: [0, 1000]
            },
            {
                progress: function(
                    elements,
                    percentComplete,
                    remaining,
                    tweenValue,
                    activeCall
                ) {
                    console.log("The current tween value is " + tweenValue);
                }
            }
        );