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 = ' '; if ($('form .is-invalid').length > 0) $('form .is-invalid').first().get(0).focus(); noLogo(); });