It works like a charm! Thanks a lot! =)

On 23 Dec, 16:24, Dave Methvin <dave.meth...@gmail.com> wrote:
> > function changeFade(i)
> > {
> >   $("#logo").fadeTo("fast",1-i/10000);
> >   $("#percentage").html(i/100 + '%');
> >   i += 100;
> >   if (i<=10000)
> >     setTimeout(changeFade(i),100);
> > }
> > $(document).ready(function(){
> >   alert('test');
> >   $("#logo").css('opacity','0.01');
> >   changeFade(100);
> > }
>
> You need to wait until the fadeTo is done before continuing on to the
> next step; neither one of those waits. This one-liner will give you a
> linear 10-second fade-in:
>
> $("#logo").hide().fadeIn(10000);
>
> Is the problem that you need to display the percentage as it fades in?
> If so, try this:
>
> $(document).ready(function(){
>     var step = 10000;
>    (function(){
>       step -= 100;
>       $("#percentage").text(step/100 + '%');
>       if ( step > 0 )
>          $("#logo").fadeTo(100,1-step/10000, arguments.callee);
>    })();
>
> });
>
> Because of overhead issues, that will most likely end up running
> longer than 10 seconds but if it's just a visual effect it won't
> matter.

Reply via email to