Sunday, August 30, 2009

[jQuery] Re: "Too much recursion"

Hello,

Thank you both. AmitTheKumar solution works fine.

Cheers

On Aug 29, 11:26 pm, AmitTheKumar <the...@gmail.com> wrote:
> I think you should try just passing the function name as the second
> parameter, instead of adding () after it.  () will cause the function
> to execute right away.  So:
>
>  function visibleFadeIn()
>  {
>          jQuery('#visible').fadeIn(2000, visibleFadeOut);
>
>  }
>
>  function visibleFadeOut()
>  {
>          jQuery('#visible').fadeOut(2000, visibleFadeIn);
>
>  }
>
> // Starts the loop
>  visibleFadeIn();
>
> On Aug 27, 11:16 pm, FCCS <brard.pie...@gmail.com> wrote:
>
> > Hello,
>
> > I'm trying to build a simple "fadeIn" - "fadeOut" loop on a div, but I
> > get an infinite recursion the way I do it :
>
> > // + Code
> > function visibleFadeIn()
> > {
> >         jQuery('#visible').fadeIn(2000, visibleFadeOut());
>
> > }
>
> > function visibleFadeOut()
> > {
> >         jQuery('#visible').fadeOut(2000, visibleFadeIn());
>
> > }
>
> > // Starts the loop
> > visibleFadeIn();
> > // - Code
>
> > There must be another way to deal with this, does someone have a
> > suggestion ?
>
> > Thank you very much,
> > FCCS

No comments: