Categories
Programming

jQuery function for slightly opaque images

Here’s a jQuery function to make your images slightly opaque (or “disabled” looking), then have them fade in when you rollover them.

Just class your <img> tags with imgfade, like this:

<img src=”someimage.jpg” class=”imgfade”>

And put this in <head> declaration:

<script language=”javascript”>
$(document).ready(function(){
$(“.imgfade”).fadeTo(1, 0.55);
$(“.imgfade”).mouseover(function(){
$(this).fadeTo(“500”, 1);
}).mouseout(function(){
$(this).fadeTo(“500”, 0.55);
});
});
</script>

Leave a Reply

OR LOG IN WITH




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