Jquery - fadeIn() and fadeOut() in PNG image. Border Solid (black) in IE8…?

倖福魔咒の 提交于 2019-12-12 13:14:29

问题


I am running a fadeIn() and fadeOut() in a block of div where there is a PNG image, with semi-transparent funds (with shadow).

See in http://jsfiddle.net/k3KUj/8/embedded/

In IE 8, it appears the hard edges when you run the fadeIn() and fadeOut(), but soon disappears. In Firefox, it's OK.

Logical to apply a background color in PNG (for example, with the link above, the background color should be light gray), it works.

But do not want to put a background color in PNG. I'm trying to get black borders do not appear in IE 8, even if you have a PNG image transparency.

Looking at the response in the forum, tried:

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)" ; /* IE8 /
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); /
IE6 & 7 */
zoom: 1;

and see in jquery IE Fadein and Fadeout Opacity

$('#bloc').css('filter', 'alpha(opacity=40)');

and see in fadeIn / fadeOut jquery problem with IE7/8 & png

$("#bloc").css('filter', 'none');

But, doesn't work. Any new idea, without applying any color in the image background transparent?

Thanks, Vinicius.


回答1:


Define a solid background color to your image:

    .container img {
         background-color: white;
    }

Define the background-image css property of your image to its src attribute:

    $('.holder-thumbs li a img').each(function() {
         $(this).css('background-image', $(this).attr('src'));
    });

Advantage: you don't need to change your markup

Disadvantage: sometimes applying a solid background color is not an acceptable solution. It normally is for me.



来源:https://stackoverflow.com/questions/4891990/jquery-fadein-and-fadeout-in-png-image-border-solid-black-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!