Skip to content

Instantly share code, notes, and snippets.

@chuyeow
Created March 4, 2009 03:37
Show Gist options
  • Save chuyeow/73697 to your computer and use it in GitHub Desktop.
Save chuyeow/73697 to your computer and use it in GitHub Desktop.
// Show popup when user hovers over a child element of a container div.
$('div.child', '#container').mouseover(function() {
$('#popup').show();
});
// But hide it only when the mouse pointer leaves the container. Mouseout doesn't
// work here because of event bubbling - it'll trigger on child elements of
// #container as well.
$('#container').bind('mouseleave', function() {
$('#popup').hide();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment