How to use
By introducing a plugin file into your Web page, you may also need to introduce jquery files because the plugin relies on the jquery library.
<script src= "Jquery.js" ></script>
<script src= "Scrolltobyspeed.jquery.js" ></script>
Now, when we want the window to scroll we give it the speed rather than the time.
$ (' #element '). Scrolltobyspeed ({
speed:1000
});
We can also add an offset to the scrolling position of the destination.
$ (' #element '). Scrolltobyspeed ({
speed:1000,
offset: -100
});
Sets the caching effect for the animation.
$ (' #element '). Scrolltobyspeed ({
easing: ' Linear '
});
The default scrolling context is the entire window. The scrolling of another scroll symbol specifies the context as a string of selectors or a jquery object.
$ (' #element '). Scrolltobyspeed ({context
: '. Foo '
});
If custom easing or callback is needed, use Plug-ins to get time and manual animations.
function () {
var $element = $ (' #element '),
duration = $element. Scrolltobyspeed ({mode: ' duration '});
...
}