-
Notifications
You must be signed in to change notification settings - Fork 630
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
Problems with event bubbling when parent prevents it #313
Comments
The problem with listening to a mouseup anywhere other than the document is that it doesn't deal with the situation where you click on the drag and move the mouse outside of it while dragging. Then the drag can appear "stuck" to the mouse pointer. It may be worth binding Is there a reason that infobox.js prevents the events from bubbling? |
Minor changes that resolve both problems as stated in issue vitch#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.
I didn't bind cancelDrag to horizontalTrack/verticalTrack as cancelDrag is insufficient for canceling the drag on that very element. I bound cancelDrag to the parameter "elem". Added comments describe which problem is tackled at which point. |
Thanks for looking into this. I've added a comment on the commit. Also, can you make sure the events are cleaned up properly (namespace them with Thanks! |
Namespaces added mouseup-events Added unbind on elem-mouseup-event in destroy()
Namespaced the events properly now. |
Is this still can on jQuery3 |
When using jScrollPane in an Element which's parent stops event bubbling, jScrollPane fails to do two things:
I encountered these problems while using jScrollPane in Google Maps' Utility libary infobox.js. Neither was easy to work out a workaround while neither editing infobox.js nor jquery.jscrollpane.js.
Example definitions
marker.info.infowindowContent = $('#markerContainer).jScrollPane();
marker.info.infowindowContentApi = marker.info.infowindowContent.data('jsp');
Workaround: Release jspDrag on mouseup
While being the easier one to find the workaround, I am uncertain if it is possible to include this into jScrollPane.
I bound an mouseup-event to the Parent (marker.info.infowindowContent), calling:
Workaround: Register mouseup on click on jspTrack (initClickOnTrack())
This one was more tricky to find, yet is probably easier ti implement into jScrollPane:
Within a setTimeout I bound a mouseup-event to the jspTrack-Element, triggering a simple mouseup-event on the document:
The setTimeout was needed solely to put it on the event stack behind the element being added to the DOM, thus no delay is needed.
The text was updated successfully, but these errors were encountered: