File: D:/HostingSpaces/SBogers10/topswtwmobile.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();
}
console.log('hoi');
});
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;
}
});