On the image hover, I want to display a different small image on it with a background and opacity so that the original image is still visible. I want to use the transition to slow the hover effect.
So here’s what I’m trying and not working:
HTML:
<img src="http://i50.tinypic.com/2poy3kl.jpg" class="test" />
CSS:
.test {
background: red url("http://i50.tinypic.com/10mue4k.png");
transition: background .25s ease-in-out;
-moz-transition: background .25s ease-in-out;
-webkit-transition: background .25s ease-in-out;
}
.test:hover {
opacity: 0.5;
}
JS Fiddle:
http://jsfiddle.net/AXQW4/2/
Can someone please help me with this?
You’ll need an additional wrapper for this. Exactly the size of the image, and give that the background. Then, when you hover over the image, you hide it and the underlying background is revealed.
Live example
HTML
CSS
No need to know the exact dimensions of the image.