SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2009
    Location
    Berlin Germany
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question ClearInterval & jQuery Help

    Hello Everyone,

    I have recently submitted a question on stack overflow and have been unable to get the help I need. Here is a recap but please check it out at: http://stackoverflow.com/questions/2...nterval-jquery

    I have 30 divs that all contain the same classes and styles. I am using a setInterval and some jquery to show 10 divs at a time. The interval slides down (slideDown) a div at the top and slides up (slideUp) a div at the bottom. Everything is working fine but I need to be able to pause the setInterval if an anchor is clicked in one of the visible divs and on the second click the interval should be set again and continue. It's basically a pause and play effect and the code can be found at the link mentioned above.

    Any advice would be greatly appreciated.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    You can do that by having the interval code check a flag variable of some kind, such as AllowSlide, so that you can return out of the interval early when it's not true.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

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
  •