HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/zelfverkopen.komma.pro/resources/assets/js/site/scrollToHandler.js
/* ==========================================================================
    Scroll To Click handler
 ========================================================================== */

var ScrollToHandler = {

    init : function(){

        $('.scroll-to-target').bind('click',function()
        {
            ScrollToHandler.scrollToTarget($(this));
            return false;
        });
    },

    /**
     * Handles click on the mouse with the arrow
     *
     * @param el
     */
    scrollToTarget : function(el){

        var scrollTo = el.prop('href');
        scrollTo = scrollTo.substr(scrollTo.indexOf('#')+1);

        ScrollToHandler.scrollToElement(scrollTo);

    },

    scrollToElement: function(id, offset, time) {

        offset = isset(offset) ? offset : 60;
        time = isset(time) ? time : 800;

        var body = $('html,body');

        body.animate({
            scrollTop: $('#' + id).offset().top - offset
        }, time);

        body.on("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", function(){
            body.stop();
        });

    }

};

ScrollToHandler.init();