【问题标题】:jQuery opacity and fadeTo(); in IE8jQuery不透明度和fadeTo();在 IE8 中
【发布时间】:2011-08-18 15:49:34
【问题描述】:

这点不起作用:

$(this).stop().fadeTo('slow', 0.4, function() {
                    $(this).addClass('hidden')
                });

所以我测试了这个:

$(this).css('opacity',0.3);

在 IE8 中没有成功:/(IE7 + Chrom + FF + Safari 一切正常 - 调试 js 一切正常...)

所以我去谷歌搜索问题并尝试了这个:

 $.fn.customFadeTo = function(speed,to,callback) {
    return this.animate({opacity: to}, speed, function() {
        if (to == 1 && jQuery.browser.msie)
            this.style.removeAttribute('filter');
        if (jQuery.isFunction(callback))
            callback();
    });
};

还有这个(CSS...):

display:inline-block;

在 IE8 中仍然没有成功...任何帮助???

更新: 这个接缝工作:

$(this).children('img').stop().fadeTo('slow', 0, function() {});

图片有问题

更新: DOM 元素 -> $(this) 指的是

<a class="alle-referenzen referenzenDetailLink" href="webdesign-referenzen-hotel-chesa-randolina" title="Hotel Chesa Randolina"> 
                <span> 
                    <b>Hotel Chesa Randolina</b><br /> 
                    Webdesign, Blog, CMS, Programmierung, Suchmaschinenoptimierung
                </span> 
                <img src="/images/content/Referenzen/HotelRandolina/Website_Hotel-Randolina.jpg" alt="Hotel Chesa Randolina" /> 
                <img class="out" src="/images/content/Referenzen/HotelRandolina/Logo_Hotel-Randolina.jpg" alt="Hotel Chesa Randolina" />            
            </a> 

【问题讨论】:

  • 这表示 : 之后的代码位
  • 表示this指的是什么dom元素? &lt;a&gt;&lt;div&gt; 等?

标签: jquery internet-explorer-8 opacity fadeto


【解决方案1】:

首先,您说“这个位不起作用”,但没有说明您想要实现什么,也没有说明该代码的结果是什么或this 指的是什么。

查看http://jsfiddle.net/YhzPh/ 我提出的另一个问题,看看是否有帮助。

【讨论】:

  • 感谢您的回复。我知道这篇文章有点草率......这有点行不通 -> 这段代码“没有表明你想要实现的目标” -> $(this) (一个特定的 div) 应该淡出我会尝试它与您的输入...谢谢现在
猜你喜欢
  • 2011-09-20
  • 1970-01-01
  • 2012-01-17
  • 2011-12-01
  • 2012-07-08
  • 2023-03-24
  • 2013-04-20
  • 1970-01-01
  • 2011-08-31
相关资源
最近更新 更多