Elegant Scroll to Top - Back to top JavaScript plugin example – Method: methods

You can check out the code below to set the parameters.
Method: methods
Example code
<link rel="stylesheet" href="http://your-domain.com/elegant-scroll-to-top/css/elegant-scroll-to-top.min.css">
<script src="http://your-domain.com/elegant-scroll-to-top/js/elegant-scroll-to-top.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
    var elegantScrollToTop = new ElegantScrollToTop({        
        onShow: function () {
            console.log('Scroll button appears');
        },
        onHide: function () {
            console.log('Scroll button disappears');
        },
        onScrollStart: function () {
            console.log('Scroll is started');
        },
        onScrollEnd: function () {
            console.log('Scroll is ended');
        }
    });
    elegantScrollToTop.init();
});
</script>
Related options
Peoprty Possible Values Default Value Description
onShow e.g. function () { console.log('Scroll button has appeared'); } null You can call this function when the scroll button has appeared.
onHide e.g. function () { console.log('Scroll button has disappeared'); } null You can call this function when the scroll button has disappeared.
onScrollStart e.g. function () { console.log('Scrolling has started'); } null You can call this function when the scrolling has started.
onScrollEnd e.g. function () { console.log('Scrolling has ended'); } null You can call this function when the scrolling has ended.