HTML DOM: Which events do not bubble?

HTML frame/object load unload scroll (except that a scroll event on document must bubble to the window) HTML form focus blur Mutation DOMNodeRemovedFromDocument DOMNodeInsertedIntoDocument Progress loadstart progress error abort load loadend From: https://en.wikipedia.org/wiki/DOM_events#Events In order to check whether an event bubbles up through the DOM tree or not, you should check the read-only bubbles property …

Read more

Javascript with jQuery: Click and double click on same element, different effect, one disables the other

The general idea: Upon the first click, dont call the associated function (say single_click_function()). Rather, set a timer for a certain period of time(say x). If we do not get another click during that time span, go for the single_click_function(). If we do get one, call double_click_function() Timer will be cleared once the second click …

Read more

Bubbling scroll events from a ListView to its parent

You need to capture the preview mouse wheel event in the inner listview MyListView.PreviewMouseWheel += HandlePreviewMouseWheel; Or in the XAML <ListView … PreviewMouseWheel=”HandlePreviewMouseWheel”> then stop the event from scrolling the listview and raise the event in the parent listview. private void HandlePreviewMouseWheel(object sender, MouseWheelEventArgs e) { if (!e.Handled) { e.Handled = true; var eventArg = …

Read more

How do I hide an element on a click event anywhere outside of the element?

If I understand, you want to hide a div when you click anywhere but the div, and if you do click while over the div, then it should NOT close. You can do that with this code: $(document).click(function() { alert(“me”); }); $(“.myDiv”).click(function(e) { e.stopPropagation(); // This is the preferred method. return false; // This should …

Read more

Direct vs. Delegated – jQuery .on()

Case 1 (direct): $(“div#target span.green”).on(“click”, function() {…}); == Hey! I want every span.green inside div#target to listen up: when you get clicked on, do X. Case 2 (delegated): $(“div#target”).on(“click”, “span.green”, function() {…}); == Hey, div#target! When any of your child elements which are “span.green” get clicked, do X with them. In other words… In case …

Read more

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

I am adding this answer for completeness because the accepted answer by @amustill does not correctly solve the problem in Internet Explorer. Please see the comments in my original post for details. In addition, this solution does not require any plugins – only jQuery. In essence, the code works by handling the mousewheel event. Each …

Read more