$(document).ready(function () { amplitude.getInstance().logEvent('page_load'); ProgressTo(10,60); }); function ProgressTo(from, to){ if($('.progress').text() == "100%"){ return;s } if(from == 0){ $('.progress').text(to + '%').css('width', to + '%').addClass('start'); }else{ $('.progress').text(from + '%').css('width', from + '%'); setTimeout( function(){ $('.progress').text(to + '%').css('width', to + '%').addClass('start'); }, 1000); } }