I can\'t seem to find any examples of this having been done anywhere on the internet before but here is what I am going to attempt to do...I\'m trying to go about the cleane
Heres the whole thing
<script type="text/javascript">
$(function(){
$("img").hover(function(){
$(this).fadeTo("slow",0);
},
function(){
$(this).fadeTo("slow",1);
});
});
</script>
<style type="text/css">
#lookhere{
background-color:orange;
width:auto;
}
</style>
Heres the html
<div id="lookhere"><img href="you know what goes here"></div>
It works and looks pretty cool. Nice idea.
Are you looking for something like this:
jQuery:
<script type="text/javascript">
$(document).ready(function(){
$("#images span > img").hover(function(){
$(this).fadeTo("fast",0.3);
},function(){
$(this).fadeTo("fast",1.0);
});
});
</script>
HTML:
<div id="images">
<span><img src="image1.jpg" /></span>
<span><img src="image2.jpg" /></span>
<span><img src="image3.jpg" /></span>
<span><img src="image4.jpg" /></span>
<span><img src="image5.jpg" /></span>
<span><img src="image6.jpg" /></span>
<span><img src="image7.jpg" /></span>
</div>
CSS:
<style type="text/css">
#images span {
display: inline-block;
background-color: orange;
}
</style>
So let's start with slightly simpler HTML:
<ul id="special">
<li><a href="#"><img src="opensrs-2.png" /></a></li>
<li><a href="#"><img src="opensrs-1.png" /></a></li>
</ul>
Here's my solution:
<style type="text/css">
#special a img { border: none;}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#special a').bind('mouseover', function(){
$(this).parent('li').css({position:'relative'});
var img = $(this).children('img');
$('<div />').text(' ').css({
'height': img.height(),
'width': img.width(),
'background-color': 'orange',
'position': 'absolute',
'top': 0,
'left': 0,
'opacity': 0.5
}).bind('mouseout', function(){
$(this).remove();
}).insertAfter(this);
});
});
</script>
EDIT: With fast fade in, fade out:
$('#special a').bind('mouseover', function(){
$(this).parent('li').css({position:'relative'});
var img = $(this).children('img');
$('<div />').text(' ').css({
'height': img.height(),
'width': img.width(),
'background-color': 'orange',
'position': 'absolute',
'top': 0,
'left': 0,
'opacity': 0.0
}).bind('mouseout', function(){
$(this).fadeOut('fast', function(){
$(this).remove();
});
}).insertAfter(this).animate({
'opacity': 0.5
}, 'fast');
});