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/somerenslust.komma.pro/resources/assets/js/site/navigationHandler.js
/* ==========================================================================
   NavigationHandler handler
 ========================================================================== */

/**
 * Navigation Handler
 * Primary usage for mobile NavigationHandler
 * Secondary if site used a pop-up/slide-in menu
 */
var NavigationHandler = {

    navElement : '',
    scrolled : 0,
    isActive : false,

    // Initialize click event
    init : function()
    {
        // Bind Navigation to Handler
        NavigationHandler.navElement = document.getElementById('mobile-navigation');

        // Bind clicks to menu button
        var mobileMenuButton = document.getElementById('mobile-menu-trigger');
        if(isset(mobileMenuButton)){
            mobileMenuButton.addEventListener('click', function(){
                NavigationHandler.toggle();
            });
        }

        // Bind clicks to sticky menu button
        var stickyMenuButton = document.getElementById('sticky-menu-trigger');
        if(isset(stickyMenuButton)){
            stickyMenuButton.addEventListener('click', function(){
                NavigationHandler.open();
            });
        }

        var mobileShade = document.getElementById('mobile-shader');
        if(isset(mobileShade)){
            mobileShade.addEventListener('click', function () {
                NavigationHandler.close();
            });
        }

        var mobileClose = document.getElementById('mobile-close');
        if(isset(mobileClose)){
            mobileClose.addEventListener('click', function () {
                NavigationHandler.close();
            });
        }

        if(isset(NavigationHandler.navElement)){
            setTimeout(function () {
                NavigationHandler.navElement.classList.add('allow-animation');
            }, 500);
        }
    },

    // Toggle navigation
    toggle : function()
    {
        if(NavigationHandler.navElement.classList.contains('active')) NavigationHandler.close();
        else NavigationHandler.open();
    },

    // Open Navigation
    open : function()
    {
        NavigationHandler.scrolled = window.pageYOffset;
        NavigationHandler.navElement.classList.add('active');
        NavigationHandler.navElement.classList.add('shader-active');
        NavigationHandler.isActive = true;

        setTimeout(function(){
            document.body.classList.add('preventScroll');
        }, 400);

    },

    // Close Navigation
    close : function()
    {

        NavigationHandler.navElement.classList.remove('active');
        NavigationHandler.navElement.classList.remove('shader-active');
        NavigationHandler.isActive = false;

        document.body.classList.remove('preventScroll');
    }
};

NavigationHandler.init();