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

events fire when not bound to that element #124

Closed
ACTwebDesigns opened this issue Jan 10, 2012 · 3 comments
Closed

events fire when not bound to that element #124

ACTwebDesigns opened this issue Jan 10, 2012 · 3 comments

Comments

@ACTwebDesigns
Copy link

http://stackoverflow.com/questions/8802836/jscrollpane-binding-to-events-adds-to-all-instances

The best way is to view the ticket above, It will cancel most questions out. I was wondering if this is a bug or there is a good explination for this.

regards

@vitch
Copy link
Owner

vitch commented Jan 10, 2012

I've responded to the question on stackoverflow. And I put together this example:

http://jsfiddle.net/qSf2q/1/

Basically the bug is in your code, as you can see in the example jScrollPane works as expected...

@vitch vitch closed this as completed Jan 10, 2012
@ACTwebDesigns
Copy link
Author

I seem to have kinda replicated this. I have nested scrollbars:

http://jsfiddle.net/qSf2q/5/

Is this a known bug?

@vitch
Copy link
Owner

vitch commented Jan 10, 2012

I'd say it's expected behaviour. Javascript events bubble. So the event on #pane2 bubbles up to it's parent and is also caught by #pane1.

Here's an example of how you can stop the event bubbling:
http://jsfiddle.net/qSf2q/6/

Note that you will still see #pane1's event fire if you use the mousewheel and scroll beyond the end of #pane2. This is by design as the mousewheel event is not caught by a pane which doesn't use it (this allows you to scroll a parent element while the mouse is over a child element which is fully scrolled). This is the same behaviour as you would have with default browser scrollbars.

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