4

下面的fadeInfadeOut效果在 Firefox 3.0 中工作正常,但在 IE 7 中不起作用……这是什么原因,有什么诀窍?这个想法当然是为了获得“眨眼”效果并将用户的注意力吸引到表格中的特定行。

function highLightErrorsAndWarnings() {
            $(".status-error").fadeIn(100).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
            $(".status-warning").fadeIn(100).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
        }

更新:发现愚蠢的问题......“.status-error”指向一个tr元素。可以在 Firefox 的 tr 上设置背景颜色并将其淡化,但在 IE 中则不行。将“CSS 指针”更改为“.status-error td ”使其指向 tr 下方的 td,并且在所有浏览器中一切正常。

4

3 回答 3

5

Weird.. couldn't tell you why you're getting that problem, but maybe try the pulsate effect plugin? http://docs.jquery.com/UI/Effects/Pulsate

于 2008-12-09T16:59:31.160 回答
1

好吧,我已经尝试了各种方法来解决这个问题。我使用的down and dirty方法是检测文本上的背景和前景色,然后div/span/etc用颜色变化来制作动画。

此片段将“脉动”文本一次(您可以通过以下方式创建一个执行更多次的函数:

$.fn.crossBrowserPulsate = function() {
    var startColor = $(this).css("background-color");
    var endColor = $(this).css("color");

    $(this).animate({color:startColor},500,
     function() {
      $(this).animate({color:endColor},500,
       ...
      )}
    );
}
于 2010-01-31T04:20:33.680 回答
1

我有类似的问题,但由于各种原因我无法选择 td。

如果您也受到影响,您可以尝试使用 show 而不是 fadeIn。由于我使用的是类似损坏的 fadeTo,所以这对我也没有帮助:(

这里打开了一个 jQuery 错误 - http://dev.jquery.com/ticket/5451

如果您受到影响,请在门票上发表评论。

于 2009-12-24T17:16:30.597 回答