【问题标题】:jQuery animation opacity doesn't work in IEjQuery 动画不透明度在 IE 中不起作用
【发布时间】:2012-04-01 00:01:44
【问题描述】:

我在 my site 的介绍中遇到了一个奇怪的问题,带有 jQ​​uery 动画。我使用视图/drupal 加载内容,然后将显示设置为无。然后我想淡入淡出每一行。

All 在所有浏览器中都运行良好,但在 IE 中却不行……有人知道为什么吗?

jQuery('.view-intro').find('.views-row-1')
    .css('display','block')
    .animate({opacity: 1.00}, time_short, 'swing')
    .animate({opacity: 1.00}, time_long, 'linear')
    .animate({opacity: 0.00}, time_short, 'swing', function(){

        jQuery('.view-intro').find('.views-row-1').css('display','none')

        jQuery('.view-intro').find('.views-row-2')
        .css('display','block')
        .animate({opacity: 1.00}, time_short, 'swing')
        .animate({opacity: 1.00}, time_long, 'linear')
        .animate({opacity: 0.00}, time_short, 'swing', function(){

            jQuery('.view-intro').find('.views-row-2').css('display','none')

            jQuery('.view-intro').find('.views-row-3')
            .css('display','block')
            .animate({opacity: 1.00}, time_short, 'swing')
            .animate({opacity: 1.00}, time_long, 'linear')
            .animate({opacity: 0.00}, time_short, 'swing', function(){

                jQuery('.view-intro').find('.views-row-3').css('display','none')

                jQuery('.view-intro').css('display', 'none')
                jQuery('.view-collections').animate({opacity: 1, paddingLeft: 0}, time_short, 'swing')

            })
        })
    })

【问题讨论】:

  • 您是否尝试过使用.fadeIn().fadeOut() 代替? jQuery 应该在这里处理跨浏览器问题。您也可以只使用.show().hide()(甚至.toggle())而不是使用.css('display',

标签: jquery internet-explorer opacity


【解决方案1】:

IE8 及以下版本无法识别 opacity css 属性,因此我建议您使用 fadeTo(),它应该可以工作。

【讨论】:

    猜你喜欢
    • 2010-12-05
    • 1970-01-01
    • 2012-11-04
    • 2014-11-02
    • 2011-05-25
    • 2011-06-12
    • 2012-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多