From d57c3ddc2134952d1b9b83c58f7a6dbd507e7fc6 Mon Sep 17 00:00:00 2001 From: A-Kalkhoff Date: Tue, 14 Jul 2015 13:27:37 +0200 Subject: [PATCH 1/2] Regarding Issue #313 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor changes that resolve both problems as stated in issue #313 Normal behaviour remains for me, though I am unsure if I know your application well enough – shouldn't raise problems though. All Changes commented with a reference to the issue. Didn't wrap "$(document).mouseup();" in a function as it's minor and self-explanatory, imho it may remain in an anonymous function. --- script/jquery.jscrollpane.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/script/jquery.jscrollpane.js b/script/jquery.jscrollpane.js index dcd36e8f..00a4e5b6 100644 --- a/script/jquery.jscrollpane.js +++ b/script/jquery.jscrollpane.js @@ -104,6 +104,9 @@ (parseInt(elem.css('paddingRight'), 10) || 0); } + // Workaround for #313 to prevent the scrollbars from being sticky if containing elements stop the propagation of the events + elem.bind('mouseup',cancelDrag); + function initialise(s) { @@ -112,7 +115,7 @@ maintainAtBottom = false, maintainAtRight = false; settings = s; - + if (pane === undefined) { originalScrollTop = elem.scrollTop(); originalScrollLeft = elem.scrollLeft(); @@ -284,6 +287,9 @@ verticalTrack = verticalBar.find('>.jspTrack'); verticalDrag = verticalTrack.find('>.jspDrag'); + // Workaround for #313 to prevent infinite loop in initClickOnTrack() if containing elements stop the propagation of the events + verticalTrack.bind('mouseup', function(){$(document).mouseup();}); + if (settings.showArrows) { arrowUp = $('').bind( 'mousedown.jsp', getArrowScroll(0, -1) @@ -382,6 +388,9 @@ horizontalTrack = horizontalBar.find('>.jspTrack'); horizontalDrag = horizontalTrack.find('>.jspDrag'); + // Workaround for #313 to prevent infinite loop in initClickOnTrack() if containing elements stop the propagation of the events + horizontalTrack.bind('mouseup', function(){$(document).mouseup();}); + if (settings.showArrows) { arrowLeft = $('').bind( 'mousedown.jsp', getArrowScroll(-1, 0) From 1039f366372eac6f8f2dcedb58d78b817e65dbc6 Mon Sep 17 00:00:00 2001 From: A-Kalkhoff Date: Tue, 14 Jul 2015 14:03:02 +0200 Subject: [PATCH 2/2] Refering issue #313 Namespaces added mouseup-events Added unbind on elem-mouseup-event in destroy() --- script/jquery.jscrollpane.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/jquery.jscrollpane.js b/script/jquery.jscrollpane.js index 00a4e5b6..c1b38a9b 100644 --- a/script/jquery.jscrollpane.js +++ b/script/jquery.jscrollpane.js @@ -105,7 +105,7 @@ } // Workaround for #313 to prevent the scrollbars from being sticky if containing elements stop the propagation of the events - elem.bind('mouseup',cancelDrag); + elem.bind('mouseup.jsp',cancelDrag); function initialise(s) { @@ -288,7 +288,7 @@ verticalDrag = verticalTrack.find('>.jspDrag'); // Workaround for #313 to prevent infinite loop in initClickOnTrack() if containing elements stop the propagation of the events - verticalTrack.bind('mouseup', function(){$(document).mouseup();}); + verticalTrack.bind('mouseup.jsp', function(){$(document).mouseup();}); if (settings.showArrows) { arrowUp = $('').bind( @@ -1234,6 +1234,7 @@ if (reinitialiseInterval) { clearInterval(reinitialiseInterval); } + elem.unbind('mouseup.jsp',cancelDrag); } // Public API