Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Handle scroll event to position thumbs #34

Closed
coeamyd opened this Issue · 0 comments

2 participants

@coeamyd

When using the scrollIntoView() method to position scrolled content, the thumbs are not repositioned accordingly. This can be achieved by handling the element's scroll event.

Unified diff of required changes:

@@ -51,8 +51,9 @@
         events: {
             wheel: "mousewheel DOMMouseScroll",
             start: "mousedown",
             drag: "mousemove",
             end: "mouseup mouseleave click",
+            scroll: "scroll",
             ignored: "select dragstart drag"
         },

@@ -123,8 +125,9 @@
                     overflow: 'hidden',
                     cursor: data.cursors.grab
                 }).on(o.events.wheel, data, o.wheel)
                   .on(o.events.start, data, o.start)
                   .on(o.events.end, data, o.stop)
+                  .on(o.events.scroll, data, o.scroll)
                   .on(o.events.ignored, false);

                 if (options.showThumbs) {
@@ -399,9 +402,17 @@

             }

            data.target.css('cursor', data.cursors.grab);

         },
+        
+        scroll: function (event) {
+            var data = event.data, flags = data.flags;
+            
+            if (!flags.dragging) {
+                o.moveThumbs(data, this.scrollLeft, this.scrollTop);
+            }
+        },

         clearInterval: function (target) {
             target = $(target);
@azoff azoff closed this in f86cc67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.