diff options
author | Thomas BrĂ¼derli | 2008-10-07 12:46:33 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2008-10-07 12:46:33 +0000 |
commit | 9b06a4bae8933c29015616177872a90cac5ef177 (patch) | |
tree | 961281ba3b5d16e22bd5806973ad61ed663b45bd /itjs/it.js | |
parent | 1e7c871a58846ee02c6f8b6478a035af4aafbce7 (diff) | |
download | itools-9b06a4bae8933c29015616177872a90cac5ef177.tar.gz itools-9b06a4bae8933c29015616177872a90cac5ef177.tar.bz2 itools-9b06a4bae8933c29015616177872a90cac5ef177.zip |
Add pngfix to javascript lib
Diffstat (limited to 'itjs/it.js')
-rw-r--r-- | itjs/it.js | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -206,3 +206,20 @@ function it_url_encode(str) return result.replace(/%20/gi, "+").replace(/%2C/gi, ",").replace(/%3B/gi, ";").replace(/%28/gi, "(").replace(/%29/gi, ")"); } + +/** + * Patch PNG transparency for IE 5.5-6 on the given image + */ +function it_pngfix(img, w, h) +{ + var old_IE = navigator.platform == "Win32" && String(navigator.userAgent).match(/MSIE ((5\.5)|6)/); + if (img.src && img.src.match(/\.png($|\?)/) && old_IE) { + img.style.width = (w || img.width) + 'px'; + img.style.height = (h || img.height) + 'px'; + img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"',sizingMethod='crop')"; + img.src = '/images/0.gif'; + } + else if (img && old_IE) + img.style.filter = 'none'; +} + |