LoginSignup
20
20

More than 5 years have passed since last update.

IE7,8で透過PNGのフェードイン時に画像がジャギる現象の解消

Posted at

IE7も8も終わってしまえばいいのに。。

jQuery
//ユーザーエージェントの取得(バージョンの取得)
var ua = window.navigator.appVersion.toLowerCase();

$(function(){
  //IE7,8の時だけ処理
  if(ua.indexOf("msie 7.") != -1 || ua.indexOf("msie 8.") != -1){
    $('img').each(function(){
      var src = $(this).attr('src');

      if(src.indexOf('.png') != -1){
        $(this).css({
          'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src+'", sizingMethod="scale");'
        });
      }

    });
  }
});

こんな感じでIE独自の拡張機能であるfilterのアルファチャンネルローダーを使う処理をかけてあげればよいらしい。

20
20
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
20
20