jquery png fix on hidden div and jquerybrowser question
- by Jared
Hello,
I have some code that if Javascript is available, it will remove a GIF image and replace it with a PNG image. The PNG is display:none and the GIF is visible.
Since IE6- browsers can't load PNG, I have loaded the jquery PNG fix. But it only seems to work if the image is already visible.
The other issue is I am trying to get the jquery.browser function to apply to less than version 6, and I am not having much luck.
<script type="text/javascript">
$(document).ready(function(){
$("#gif").hide();
jQuery.each(jQuery.browser, function(i, val) {
if($.browser.msie && jQuery.browser.version <="6"){
$("#png").show();
$('.png').pngFix()
}else{
$("#png").fadeIn("slow");
}
});
});
</script>
HTML
<img class="png" id="png" src="images/main_elements/one-2-flush-it-campus-challenge.png" style="display:none;" />
<img id="gif" src="images/main_elements/one-2-flush-it-campus-challenge.gif"/>