Prevent scrolling of parent element when inner element scroll position reaches top/bottom?

I have a little “floating tool box” – a div with position:fixed; overflow:auto. Works just fine. But when scrolling inside that box (with the mouse wheel) and reaching the bottom OR top, the parent element “takes over” the “scroll request” : The document behind the tool box scrolls. – Which is annoying and not what … Read more

How do I prevent a parent’s onclick event from firing when a child anchor is clicked?

I’m currently using jQuery to make a div clickable and in this div I also have anchors. The problem I’m running into is that when I click on an anchor both click events are firing (for the div and the anchor). How do I prevent the div’s onclick event from firing when an anchor is … Read more

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I’ll use jQuery in the examples, but this applies to plain-JS as well: 1. event.preventDefault() $(‘a’).click(function (e) { // custom handling here e.preventDefault(); }); 2. return false $(‘a’).click(function () { // custom … Read more