Skip to content

Instantly share code, notes, and snippets.

@wilornel
Created April 28, 2012 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wilornel/2519550 to your computer and use it in GitHub Desktop.
Save wilornel/2519550 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src='jquery.js'></script>
<script>
$(document).ready(function(){
// When hovered
$('#leftTab').on('mouseenter', '.starImg', function(){
console.log('asdasd');
this.src = 'images/stardown.png';
}).on('mouseleave', '.starImg', function(){
this.src = 'images/starup.png';
console.log('mouseleave');
});
// When clicked
$('.starImg').live('click', function(){
$(this).on('mouseleave', function(event){ event.stopPropagation(); });
});
});
</script>
</head>
<body>
<div class="star" rel="9"> // When the user clicks this, it sends an ajax Request to the server
<img class="starImg" src="images/starup.png">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment