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/yoda-ict/yoda-ict.nl/wwwroot/public/js/mobile_bac.js
// Properties
var $body = $('body');
var $mb = $('.mobile');
var $mbBlur = $('.mobile .blur');
var $mbBtnNav = $('.mobile_btn.nav');
var $mbBtnContact = $('.mobile_btn.contact');
var $mbContent = $('.mobile .content');
var $mbNav = $('#mobile_nav');
var $mbContact = $('#mobile_contact');

// Platforms
var mobileSafari = false;
mbCheckPlatform();

if(mobileSafari)
{
    $('a',$mb).hover(function(){ $(this).css({ background: 'none' }) });
}

// Listen to touch devices
 window.addEventListener('touchmove', function(event) {
     var $target = $(event.target);
     if( ! $target.hasClass('scrollable') && ! $target.parents('.scrollable').length) {

         // Disable touch scroll
         event.preventDefault();
     }
 }, false);

// On button click
$mbBtnNav.click(function(){
    if($mbNav.height() > 0){ mbHideMenu(); mnUnlockBody(); }
    else{ mnLockBody(); mbShowMenu(); }
});

// Show navigation
function mbShowMenu()
{
    // Slide out menu
    var ulH = $mbNav.children('.inner').outerHeight();
    $mbNav.height(ulH);
}

// Hide navigation
function mbHideMenu()
{
    // Collapese menu
    $mbNav.height(0);
}

// Show contact
function mbShowContact()
{
    // Slide out menu
    var ulH = $mbNav.children('.inner').outerHeight();
    $mbNav.height(ulH);
}

// Hide contact
function mbHideContact()
{
    // Collapese menu
    $mbNav.height(0);
}


// Lock the body underneath the mobile menu
function mnLockBody()
{
    //  Get 100%
    var h100 = $(window).height();
    if(mobileSafari) h100 += 70;

    // Show mobile
    $mb.css({ height: h100+'px', overflow: 'auto' });

    // Disable mouse scroll
    $body.css({ height: h100+'px', overflowY: 'hidden'  });

    // Disable touch scroll
    $body.removeClass('scrollable')

    // Show blur
    setTimeout(function(){ $mbBlur.css({  opacity: .9 }); },20);
}

// Unlock the body underneath the mobile menu
function mnUnlockBody()
{
    // Enable mouse scroll
    $body.css({ height: 'auto', overflowY: 'scroll'  });

    // Enable touch scroll
    $body.addClass('scrollable')

    // Hide blur
    setTimeout(function(){ $mbBlur.css({ opacity: 0 }); },20);

    // Hide mobile
     setTimeout(function(){ $mb.css({ height:'60px',overflow: 'hidden' }) } ,500);
}

// On window resize
mbResize();
$(window).resize(mbResize);
function mbResize()
{
    var h = $(window).height() - 60;
    $mbContent.height(h);
}

// Check if mobile safari
function mbCheckPlatform()
{
    // Assign a variable for the device being used
    var nAgt = navigator.userAgent;

    // First check to see if the platform is an iPhone or iPod
    if(navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
        // In Safari, the true version is after "Safari"
        if ((nAgt.indexOf('Safari'))!=-1) {
            // Set a variable to use later
            mobileSafari = 'Safari';
        }
    }
}