Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Image Rollover and IE7 Re: Image Rollover and IE7

#104827
mevaser
Participant

The css way was not working, so I did it via jquery, ha ha.



jQuery(function($) {
$(document).ready(function(){

// Preload all rollovers
$("#roller img").each(function() {
// Set the original src
rollsrc = $(this).attr("src");
rollON = rollsrc.replace(/.jpg$/ig,"_over.jpg");
$("").attr("src", rollON);
});

// Navigation rollovers
$("#roller a").mouseover(function(){
imgsrc = $(this).children("img").attr("src");
matches = imgsrc.match(/_over/);

// don't do the rollover if state is already ON
if (!matches) {
imgsrcON = imgsrc.replace(/.jpg$/ig,"_over.jpg"); // strip off extension
$(this).children("img").attr("src", imgsrcON);
}

});
$("#roller a").mouseout(function(){
$(this).children("img").attr("src", imgsrc);
});

});
});




Training




Thanks,