Creating a simple fade over effect – JQuery

Here , i will tell you how to add a fade over /fade in effect to image button in jquery. its very simple……………………………

1. Import jquery

<script type='text/javascript' src='http://yoursite.com/jquery.js'></script>

2. Add a div tag with image in it

<div class="fadeDiv">
    <img src="1jpg" alt="" />
    <img src="2.jpg" alt="" />
</div>

3 .  Add script Jquery on load

$(document).ready(function(){
 $("img").hover(
 function() {
 $(this).animate({"opacity": "0"}, "slow");
 },
 function() {
 $(this).animate({"opacity": "1"}, "slow");
 }
 );
});

That’s it . you can now see the fade in and fade out effect on mouse over the button
you can change the js to add more functionalites.

This entry was posted in Javascript and tagged , , , , , . Bookmark the permalink.

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=""> <strike> <strong>