Skip to content

Instantly share code, notes, and snippets.

@gnarf
Forked from wilornel/main.php
Created April 28, 2012 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnarf/2519894 to your computer and use it in GitHub Desktop.
Save gnarf/2519894 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
function stopprop( event ) { event.stopPropagation(); }
function starhover( event ) {
console.log( event.type );
this.src = ( event.type === "mouseenter" ) ? 'images/stardown.png' : 'images/starup.png';
}
$('#leftTab').on({
// When hovered
mouseenter: starhover,
mouseleave: starhover,
// When clicked
click: function() {
$( this ).on( 'mouseleave', stopprop );
}
}, ".starImg" );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment