I've been developing my website in both Firefox and IE 8. There's an image hover effect on the main page (as well as in the photography and drawing sections). You can see the code in the source at http://www.dgendill.com. In Firefox, the effect works perfect. In IE 8, it works, but it's much, much slower. Here's what I've tried to improve the speed:
- Used the optimized jQuery library
Narrowed the scope with which jQuery traverses the DOM. For instance:
$(".sectionLink","#divLandingPage").hover( function(){ $(this).addClass("hover"); $(this).fadeTo(100,.8); }, function(){ $(this).removeClass("hover"); $(this).fadeTo(100,.99); } );
I've tried changing the display type of the image. Display block, inline-block, and inline.
Any ideas why IE 8 is so much slower? My HTML is valid 4.01.
Here's a guy that's worked with the same problem: http://mdasblog.wordpress.com/2009/07/24/jquery-fun-with-animation-and-opacity/
I've decided to just disable the hover effect in IE.
if(jQuery.support.opacity) {
$(".sectionLink","#divLandingPage").hover(
function(){
$(this).addClass("hover");
$(this).fadeTo(100,.8);
},
function(){
$(this).removeClass("hover");
$(this).fadeTo(100,.99);
}
);
}