# easy-elements/1.4.4/widgets/scroll-to-top/js/scroll.js

Easy Elements for Elementor – Addons &amp; Website Templates, version 1.4.4. 38 lines.

- Page: https://pluginprobe.com/plugins/easy-elements/1.4.4/code/widgets/scroll-to-top/js/scroll.js
- Raw: https://pluginprobe.com/plugins/easy-elements/1.4.4/raw/widgets/scroll-to-top/js/scroll.js
- Modified: 2026-05-07T12:44:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-elements/1.4.4/code/widgets/scroll-to-top/js/scroll.js#L10-L20`.

```javascript
(function($) {
    "use strict";
    $(document).ready(function(){
        var win = $(window);
        var totop = $('#easyel-top-to-bottom');
        function checkScroll(currentScroll) {
            if (currentScroll > 150) {
                totop.fadeIn();
                $('header').addClass('eel-scoll-to-top');
                totop.addClass('eel-scroll-visible');
            } else {
                totop.fadeOut();
                $('header').removeClass('eel-scoll-to-top');
                totop.removeClass('eel-scroll-visible');
            }
        }
        if (window.lenis) {
            window.lenis.on('scroll', (e) => {
                checkScroll(e.scroll);
            });
        } else {
            win.on('scroll', function() {
                checkScroll(win.scrollTop());
            });
        }
        totop.on('click', function(e) {
            e.preventDefault();
            if (window.lenis) {
                window.lenis.scrollTo(0, { 
                    duration: 1.2,
                    easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)) 
                });
            } else {
                $("html, body").animate({ scrollTop: 0 }, 500);
            }
        }); 
    });
})(jQuery);
```
