HTML
JQUERY
setInterval(function() { var $active = $("#header-splats .active"); var $next = $active.next().length ? $active.next() : $("#header-splats div:first"); $active.fadeOut("slow", function() { $active.removeClass('active'); }); $next.fadeIn("slow").addClass('active'); }, 3000);
CSS
#header-splats, #header-splats div { width: 106px; height: 106px; } /* overlap each other */ #header-splats div { position: absolute; top: 0; left: 0; display: none; } #header-splats div.active {display: block;}
This looks great in all browsers except IE, as you can see in these images:
THE SOLUTION: apply the following Microsoft filter in the CSS to each image (make sure you update the image path for each one).
CSS
#splat-1 img {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='/images/splats/splat1.png');} #splat-2 img {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='/images/splats/splat2.png');} #splat-3 img {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='/images/splats/splat3.png');}
Hey Jack, nice post.
ReplyDeleteOn my site, I use a JS based PNG fix for IE, seems to fix most PNG transparency related issues and works well with jQuery. Here is the code I use
http://www.voodoochilli.com/scripts/pngfix.js
I call it using an IF IE condition, for example
I'd be interested to know if this resolves you issues as well as your own solution.
P.S congratulations on the traffic levels.
Harry
Oh seems like blogger strips out code...but you get the point.
ReplyDeleteLooking at the code, seems to do the exact same thing as your proposed solution anyway. Might be worth keeping it in an external file (if you haven't already)
ReplyDelete:)
Yer that script is useful for development and maintenance as you don't need to do anything for each individual image, so adding new ones etc is easy peasy.
ReplyDeleteBut I think in a lot of situations it will be overkill - if you only need to apply the MS filter on say 3 images on the whole site (as I did), and they never change, it is more efficient to just hardcode it in the CSS, rather than run a script every page load, scanning the DOM for image tags.