jQuery opacity和fadeTo();在IE8中

时间:2011-05-04 15:29:32

标签: jquery internet-explorer-8 opacity fadeto

这一点不起作用:

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

所以我测试了这个:

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

在IE8中没有成功:/(IE7 + Chrom + FF + Safari一切都好 - 重新启动js everthing ok ...)

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

 $.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> 

1 个答案:

答案 0 :(得分:0)

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

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