Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle scroll event to position thumbs #34

Closed
coeamyd opened this issue Dec 6, 2011 · 0 comments
Closed

Handle scroll event to position thumbs #34

coeamyd opened this issue Dec 6, 2011 · 0 comments
Milestone

Comments

@coeamyd
Copy link
Contributor

coeamyd commented Dec 6, 2011

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 as completed in f86cc67 Dec 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants