Search

10/14/2008

Imageload with downgrade graceful

http://chunghe.googlecode.com/svn/trunk/project/image.loader.downgrade.graceful/index.htm

For browsers support javascript, it will behave like normal imageload do.
For those don't, it will still display images.

The little trick is that


<script>
document.write('<style>.yui-imgload-scrollgroup{background:none !important}</style>');
</script>

For those browser doesn't support javascript, it simply ignore script tag. Without the "background:none !important" decoration, the image will still show up.
In the other hand, if browsers support javascript, it will write <style>.yui-imgload-scrollgroup{background:none !important}</style> and behave just like normal imageload.

I think these's still some better ways than document.write, but this is a OK method for adopting imageload.

沒有留言: