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/topswtw.komma.pro/wwwroot/js/app/mobile.js
/**
 * Created by Pascal on 01/12/16.
 */

$(function(){

    var scrolled = 0;
    var mobileActive = false;

    $('input[name="invoice-city"]').bind('change', function () {
        $('#pac-input').val($(this).val());
    });


    $('.animate').removeClass('animate');

    var st = 0;
    var lastScrollTop = 0;
    var timeoutId;
    $(window).scroll(function(){
        stickyBarScrollCheck();
        if(timeoutId ){
            clearTimeout(timeoutId );
        }
        timeoutId = setTimeout(function(){
            if(lastScrollTop < 75) $('header .sticky-bar').removeClass('show');
        }, 200);
    });


    $('.mobile-navigation .shader').click(function () {
        disableMobileMenu();
    });

    $('.mobile-navigation .bar .toggle-menu, header .link-content').click(function(){
        if( ! mobileActive){
            enableMobileMenu();
        }
        else{
            disableMobileMenu();
        }
    });

    function enableMobileMenu() {
        scrolled = $(window).scrollTop();
        $('.mobile-navigation').addClass('active');
        mobileActive = true;

        //Add the fixed position after Mobile menu animation
        setTimeout(function(){
            $('body').addClass('preventScroll');
        }, 400);

    }

    function disableMobileMenu() {

        console.log(scrolled);

        $('.mobile-navigation').removeClass('active');
        $('body').removeClass('preventScroll');
        mobileActive = false;
        $(window).scrollTop(scrolled);
    }

    function stickyBarScrollCheck() {
        st = $('body').scrollTop();
        if (st > lastScrollTop){
            // downscroll code
            $('header .sticky-bar').removeClass('show');
        }
        else {
            //upscroll
            if(lastScrollTop >= 100) $('header .sticky-bar').addClass('show');
            else $('header .sticky-bar').removeClass('show');
        }
        lastScrollTop = st;
    }

});