【问题标题】:Jquery and IE8 animate opacity solutionJquery 和 IE8 动画不透明度解决方案
【发布时间】:2023-03-24 13:22:01
【问题描述】:

我正在尝试使用 Jquery 为不透明度设置动画,它在每个浏览器中都可以正常工作,除了,你猜它害怕 IE8
问题:在动画上我看到一些丑陋的工件:(
我知道我可以通过删除背景并将相同的背景颜色添加到我的动画 div 和我的容器 div 来解决这个问题,但在我的情况下,不是一个选项。
有人可以提出解决方案吗? 我的代码:

$(document).ready(function() {
    $(".img").animate({
        opacity: 0
    });
    $(".glow").click(function() {
        $(".img").animate({
            opacity: 1
        }, 5000);
    });
});

【问题讨论】:

  • 您是否考虑过使用 fadeTo 代替? (不确定这是否能满足您的要求。)
  • 在我看来更像是一个 clearfix 问题,因为 jQuery 解决了 IE 中的不透明度问题。出于某种原因,这里的 IE8 模式(使用 IE9)很好?

标签: javascript jquery


【解决方案1】:

通过在我的 CSS 中添加 IE 过滤器,我已经部分解决了这个问题(现在好多了,而且没有黑晕了)。
为此浪费了一整天,所以我希望它能帮助比我更幸运的人:)

 .img{
 display:block;
 width:230px;
 height:300px;
 owerflow:hidden;
 position:relative;
 outline:none;

 /*Notice (ugly) IE filter here and Source to my PNG image */

 filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://www.robertpeic.com/glow/glow.png) alpha(opacity=0);
 background:none;
 margin:0px auto;
 padding-top:10px;

 }

【讨论】:

    【解决方案2】:

    这就是在 IE7 和 IE8 中更改具有 Alpha 透明度的图像的不透明度时得到的结果。还有一个关于同一个问题IE GIF/PNG Transparency issue with jQuery

    【讨论】:

      猜你喜欢
      • 2011-12-01
      • 1970-01-01
      • 2011-06-30
      • 2011-01-25
      • 2011-09-20
      • 2011-08-18
      • 1970-01-01
      • 1970-01-01
      • 2013-10-04
      相关资源
      最近更新 更多