fadeIn / fadeOut jquery problem with IE7/8 & png

∥☆過路亽.° 提交于 2019-12-24 01:45:33

问题


Hey guys, I am trying to make a magnifying glass background when the use hovers over an image that can be enlarged. This is using a blank span and setting its display to none until it is hovered, and having its background be a semi-transparent png with a magnifying glass in the center.

This is done using fadeIn / fadeOut and works perfectly in all of the other browsers besides IE.

In IE, the background of the image flashes to dark gray before fading to the correct image on hover and hover out.

Here is the example of what I am working on, its the three smaller images in a row:

http://www.brainbuzzmedia.com/themes/amplify/html/index.html

I have read that the solution to this is adding a background color to the element that is fading, but obviously that wouldn't work because I need to use a semi-transparent png as the background. Anyone have any idea what I can do with this?


回答1:


I don't get the flash to dark gray. What I can think of as a solution is either have another div the same size as the image positioned absolutely behind the image and have that use the png background.

OR

use the opacity property and ms filter for IE.




回答2:


I had a similar issue.

After the fadein / fadeout try calling:

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

It worked for me when IE 7 & 8 left nasty black smudges where the opacity should have been after doing a fade effect.




回答3:


See this article, similiar issue:

jQuery IE Cleartype glitch on fadeout!

The trick is to use a delay then fadeOut.



来源:https://stackoverflow.com/questions/3615597/fadein-fadeout-jquery-problem-with-ie7-8-png

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