var oldScrollY = 0; function damageLogo(execution) { var timer = 30; if (execution > 9) timer = 400; $('#logo span').animate({ opacity: Math.random().toFixed(2) }, timer, function() { if (execution > 10) noLogo(); else damageLogo(execution + 1) }); } function noLogo() { $('#logo span').css('opacity', 0); $('#logo span').text('UBATECH'); setTimeout(function() { fixLogo(); }, 1200); } function fixLogo() { $('#logo span').animate({ opacity: 1 }, 800); $('#logo img').animate({ opacity: 1 }, 800, function(){ $('#logo span').text('UBATECH'); }); } $(function(){ var nbsp = ' '; function detectMob() { const toMatch = [ /Android/i, /webOS/i, /iPhone/i, /iPad/i, /iPod/i, /BlackBerry/i, /Windows Phone/i ]; return toMatch.some(function(toMatchItem){ return navigator.userAgent.match(toMatchItem); }); } // Phone number $('#phone').append('...' + nbsp).prepend('501' + nbsp).prepend('+48'+ nbsp).append('05' + String.fromCharCode(49)); $('#phone').click(function(){ $('#phone').unbind(); $.getJSON("/phone", function( data ) { $('#phone').html($('#phone').text().replace('...', data.phone)); if (detectMob()) { $('#phone').addClass('callto'); $('#phone').attr('href', 'tel:'+$('#phone').html().replaceAll(nbsp, '')); } }); }); damageLogo(0); $.getJSON("/json/FixlyFeedback.json", function( data ) { $.each(data.Fixly, function(i, value){ var card = '\
\
\

"${value.feedback}"

\

${value.date}

\
\
'; // IE compatibility :( card = card.replace('${value.img}', value.img); card = card.replace('${value.feedback}', value.feedback); card = card.replace('${value.date}', value.date); $( "#carouselSlides .carousel-inner" ).append( '' ); }); $('#carouselSlides').carousel({ interval: 5000, ride: true }); } ); $(window).scroll(function() { var y = Math.round($(window).scrollTop() / 3 + 110); if (y != oldScrollY) { $( "body.main" ).css('background-position', 'center ' + y + 'px'); oldScrollY = y; } }); });