I am currently implementing a cool image fade swap effect using CSS and JQuery along with an image sprite.
JQuery:
<script type="text/javascript>
$(document).ready(function() {
$('.otherbutton').append('<img class="hover" />').each(function () {
var $span = $('> img.hover', this).css('opacity', 0);
$(this).hover(function () {
$span.stop().fadeTo(500, 1);
}, function () {
$span.stop().fadeTo(500, 0);
});
});
});
</script>
CSS:
<style>
.otherbutton {
clear: both;
position:relative;
display:block;
height: 28px;
width: 28px;
background: #FFFFFF url(images/searchButton.png) no-repeat;
background-position:0 0;
cursor: pointer;
}
.otherbutton img.hover {
position: absolute;
display: block;
height: 28px;
width: 28px;
background: #FFFFFF url(images/searchButton.png) no-repeat;
background-position: bottom;
}
</style>
HTML:
<span class="otherbutton"></span>
When testing in Firefox, the image displays correctly, but in Internet Explorer 8, 9, and 10, the hover image appears as "NOT FOUND". Any suggestions on how to resolve this issue?