I animate simply object using:
$("#progress").animate({width:400},2000)
Than i also want to view it’s width like that
$("#loadingpro").html(pro+"%");
pro = Math.round(procent$("#progress").width()/4);
But when I am doing it like that it’s start to delay whole cpu so much that it is not possible to do it at all.
Any ideas how I can try to do it in other way?
You could use
setInterval()andclearInterval(). Play around with the interval to get it smooth. ~20 microseconds is what worked for me:jsFiddle example
.setInterval()is a good choice, since you can stop it withclearInterval()in theanimate()callback once all your calculations are done.