Double scrolling issue in 1.2.6 for Scrollable #591

Closed
alibby251 opened this Issue Dec 11, 2011 · 4 comments

Projects

None yet

5 participants

@alibby251
Collaborator

There is an issue with the autoscroll plugin for the scrollable object. If you use the nav while it is autoscrolling, it causes a strange double scroll when the next autoscroll fires. It is like it creates a new timeout without removing the first one.

Steps to repeat:

  1. Go to http://flowplayer.org/tools/scrollable/autoscroll.html
  2. Click Play
  3. Let the autoscroll fire once
  4. After 2 seconds, click the left arrow nav button to go back one slide
  5. Watch what happens when the autoscroll fires in the future

In fact, if you click the nav multiple times, it seems to create additional timeouts for each click. You can really get this thing to freak out!

(copied from http://flowplayer.org/tools/forum/35/83512)

@evrard
evrard commented Dec 20, 2011

I have done a modification on the scrollable.autoscroll.js source (see https://github.com/jquerytools/jquerytools/blob/master/src/scrollable/scrollable.autoscroll.js) that seems to solve the issue :

Before line 47, tell the scroll() function to clear the timeout if there is one, if this case, where the scrollable API will seek on any item, the autoscroll API will reset its timeout.

      function scroll(){
        // Fixes https://github.com/jquerytools/jquerytools/issues/591
        if (timer) clearTimeout(timer); // reset timeout, especially for onSeek event
        timer = setTimeout(function(){ // assign a new one
          api.next();
        }, opts.interval);
      }

Let me know if it sounds correct for you.

Loops

@jagregory

@evrard I've had the same issue and this does the trick. Thanks for the fix!

@jacqueminv

+1
Should be merged in the master branch!

@evrard have you submitted a pull request?

@evrard
evrard commented Jan 16, 2012

@poxd There is no pull request for this bugfix, sorry.

@duclet duclet closed this Jan 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment