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:
Post a Comment