diff options
Diffstat (limited to 'docroot/pngbehavior.htc')
-rwxr-xr-x | docroot/pngbehavior.htc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/docroot/pngbehavior.htc b/docroot/pngbehavior.htc new file mode 100755 index 0000000..31367d1 --- /dev/null +++ b/docroot/pngbehavior.htc | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Material Experience - IE 6 PNG Behavior | ||
3 | * | ||
4 | * EYEMG - Interactive Media Group | ||
5 | * Created by Mike Crute (mcrute@eyemg.com) | ||
6 | * Updated by Mike Crute (mcrute@eyemg.com) on 9/26/07 | ||
7 | * | ||
8 | * Fixes the transparent PNG issue with IE 6. We only modified this | ||
9 | * code, it actually came from: | ||
10 | * http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html | ||
11 | */ | ||
12 | <public:component lightWeight="true"> | ||
13 | <public:attach event="onpropertychange" onevent="propertyChanged()" /> | ||
14 | <script type="text/javascript"> | ||
15 | var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) && navigator.platform == "Win32"; | ||
16 | var blankSrc = "/images/blank.gif"; | ||
17 | |||
18 | if (supported) fixImage(); | ||
19 | |||
20 | function propertyChanged() { | ||
21 | if (!supported) return; | ||
22 | if (event.propertyName != "src") return; | ||
23 | if (src == blankSrc) fixImage(); | ||
24 | } | ||
25 | |||
26 | function fixImage() { | ||
27 | var src = element.src; | ||
28 | var alt = element.alt; | ||
29 | var realSrc; | ||
30 | |||
31 | if (!new RegExp(blankSrc).test(src)) | ||
32 | realSrc = src; | ||
33 | |||
34 | if (/\.png$/i.test(realSrc)) { | ||
35 | element.src = blankSrc; | ||
36 | element.alt = alt; | ||
37 | element.title = alt; | ||
38 | element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + ")"; | ||
39 | } | ||
40 | } | ||
41 | </script> | ||
42 | </public:component> | ||