26
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jQuery、IE8以下で透過PNGが黒くなる場合の対処法

Last updated at Posted at 2014-06-25

jQuery、IE8以下で透過PNGが黒くなる場合の対処法

■about

jQuery、IE8以下で透過PNGが黒くなる場合の対処法。
CSSにて透過PNGを使っている要素にprogid:DXImageTransformのfilterを指定する。

■code

JavaScript
/* #mainNav img透過処理 */
$(function() {
    if(navigator.userAgent.indexOf("MSIE") != -1) {
        $('#mainNav img').each(function() {
            if($(this).attr('src').indexOf('.png') != -1) {
                $(this).css({
                    'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + $(this).attr('src') + '", sizingMethod="scale");'
                });
            }
        });
    }
});

■reference

IE8以下で透過PNGが黒くなる場合の対処法 | 技術屋のメモ | HTML,CSS,JavascriptなどWEB技術メモ
http://www.ateliee.com/archives/1093

26
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?