SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery delay problem

    Hi all,
    I am using jquery delay in my site but it's not working as expected.

    the script goes this way:

    $('#sendingMessage').fadeIn().delay(3000).

    can any one help me with this
    Regards

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    Sacramento, CA, USA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .delay() is usually used to add a pause between jQuery effects. I don't think tacking it on after an effect does anything. If you want to do something after the fadeIn has completed, use the callback function built into fadeIn:

    Code:
    $('#sendingMessage').fadeIn('slow', function() {
      // Execute something after the fade is complete
    });
    I like this better anyway since it's event driven and not just adding idle time to the code. Not sure if that accomplishes what you want, though.... Alternatively you could use a setTimout, but again, it's not based on the event.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2010
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thnx for u'r immediate reply.
    i used the call back just the way you suggested.
    but i wanted to know one thing - is there any limit for the delay we shuld set ??
    iam trying to set a delay of almost 1/2 min. is it possible by delay?
    Or can u suggest any other method for tht??
    Thanx and regards


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •