I'm not sure if I understand correctly what you want. If it is
something that updates a container element with an increasing number
(from 0 to a provided limit), then this will do it:
var progressIndicator = function(element, upTo) {
var element = $(element), upTo = upTo || 100, percent = 0;
new PeriodicalExecuter(function() {
if (percent >= upTo) this.stop()
element.update(percent++ + "%");
}, 0.05);
}
progressIndicator("container"); // will go all the way up to 100%
progressIndicator(someElement, 50); // will finish in 50%
Best,
-Nicolas
On Feb 11, 2008 7:04 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> im so S.....
>
> upp: function(val,pourcent,k,z) {
>
>
> if(!k)var k=0;
> if(k<=val){
> $(pourcent).update(k+'%');
> if(!z) var z=0;
> while(z<100)
> ++z;
> setTimeout(function(){this.upp(val,pourcent,k,z);}.bind(this), 50);
> ++k;
> }
> },
> wonder if there s no clean way to do this
>
> ;)
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---