Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created July 4, 2010 22:48
Show Gist options
  • Save badsyntax/463826 to your computer and use it in GitHub Desktop.
Save badsyntax/463826 to your computer and use it in GitHub Desktop.
// delegate a list item mouseenter event to a list
function mouseenter( event ){
$( event.target ).addClass( 'mouseenter' );
}
$('ul').delegate( 'li', 'mouseenter', mouseenter );
// trigger the first list items delegated event
$('ul').find('li:first').each(function(){
mouseenter.apply( this.parentNode, [ { target: this } ]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment