Use jQuery for that, it really simplifies things:
Code:
<!DOCTYPE html>
<html>
<head>
<title>jQuey Hover Fade In Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$('.faders').css({opacity: 0.5}).hover(function(){
$(this).stop().animate({opacity: 1});
}, function(){
$(this).stop().animate({opacity: 0.5});
});
});
</script>
<style type="text/css">
body {
color: #ccc;
background-color: #000;
}
</style>
</head>
<body>
<p><img class="faders" src="photo1.jpg" alt="original image" title=""></p>
<p><img class="faders" src="photo2.jpg" alt="original image" title=""></p>
</body>
</html>
Demo:
http://home.comcast.net/~jscheuer1/s...s/hover_in.htm
Bookmarks