PNG Behavior

Below is the complete source for the behavior. Notice that the behavior will only do anything if the user is using IE55+ on a Win32 platform.

CODE:
<public:component>
  <public:attach event="oncontentready" onevent="filterImage()" />
    <script language="jscript">
    var original = element.src;
    var spacer = "images/blank.gif";
    var htc = /MSIE ((5\.5)|[6])/.test(navigator.userAgent) && navigator.platform == "Win32";
    function filterImage() {
    if(/\.png$/.test(original) && htc) {
    element.style.visibility = 'hidden';
    var preload = new Image();
    preload.onload = function() {
        element.style.height = element.style.height ? element.style.height : this.height;
        element.style.width = element.style.width ? element.style.width : this.width;
        element.src = spacer;
        element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + original + ", sizingMethod='scale', enabled='true')";
        element.style.visibility = 'visible';
    }
    preload.src = element.src;
    }
}
</script>
</public:component>


Usage

The usage is really simple. All you need to do is to add the png behavior to the image element.

<style type="text/css">

img {
   behavior: url("pngbehavior.htc");
}

</style>

20 comments:

成熟,就是有能力適應生活中的模糊。.................................................................

人生是故事的創造與遺忘。............................................................

No garden without its weeds.............................................................

在你一無所有的時候 是誰在陪伴你 他便是你最重要的人............................................................

A contented mind is a perpetual feast...................................................................

看得見您的用心~~希望這裡愈來愈熱鬧哦~~............................................................

文章優,圖片美,就連回文都很有意思~~~............................................................

耐斯的部落格值得推蔫!............................................................

Joy often comes after sorrow, like morning after night.. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

做好事,不需要給人知道,雖然只是一件微不足道的事,但我相信,這會帶給我快樂。..................................................

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................

「仁慈」二個字,就能讓冬天三個月都溫暖。..................................................

生命中最美麗的報償之一便是幫助他人的同時,也幫助了自己。.......................................................

人應該做自己認為對的事,而不是一味跟著群眾的建議走。..................................................

cool blog,期待更新............................................................

你快d upday個blog啦~我等左好耐啦/_愛死呀ling之fans上 ............................................................

好的部落格就要和好朋友分享--感謝分享..................................................

相見亦無事,不來常思君......................................................................

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................

A time seems to come in every woman’s life when she gets an uncontrollable urge to give her home a thorough cleaning. Many women still follow the old-fashioned spring and fall schedule. Spring cleaning was unavoidable many years ago when coal stoves were used all winter, coating everything with a thick, greasy dirt.

removal company London | removal companies London

Post a Comment