Top Menu
A Simple Mouseover Hover Effect with jQuery
To make it all work, we first need to add the jQuery library script between the tags.
<script src=”http://yoursite.com/jquery.js” type=”text/javascript”>
</script></div>
Now lets create the function that will make it all work.

<script  type='text/javascript'>
$(document).ready(function(){
$(".button").hover(function() {
$(this).attr("src","button-hover.png");
}, function() {
$(this).attr("src","button.png");
});
});
</script>
 
The one thing you need to make sure is that the classname in the jQuery 
function (.button) matches the classname of the image tag (button).
 
<img src="button.png" alt="My button" class="button" />
 

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Close