jquery - 在 IE 中使用 Jquery 动画不透明度时,图像会被剪裁

标签 jquery jquery-animate

我使用下面给出的函数:

function rotate() {
            //Get the first image
            var current = ($('div#rotator ul li.show') ? $('div#rotator ul li.show') : $('div#rotator ul li:first'));

            //Get next image, when it reaches the end, rotate it back to the first image
            var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') : current.next()) : $('div#rotator ul li:first'));

            //Set the fade in effect for the next image, the show class has higher z-index
            next.css({ opacity: 0.0 })
            .addClass('show')
            .animate({ opacity: 1.0 }, 1000);

            //Hide the current image
            current.animate({ opacity: 0.0 }, 1000)
            .removeClass('show');

        };

它可以幻灯片放映图像。它在 Firefox 和 Google Chrome 上运行完美,但在 IE 7 和 IE 8 中剪辑图像。非常感谢任何帮助。

提前致谢。

最佳答案

您使用的是哪个版本的 jquery?

尝试添加 IE 的不透明度值,如下所示:

//Set the fade in effect for the next image, the show class has higher z-index
next.css({ opacity: 0.0, filter: 'alpha(opacity=0)' })
.addClass('show')
.animate({ opacity: 1.0, filter: 'alpha(opacity=100)' }, 1000);

//Hide the current image
current.animate({ opacity: 0.0, filter: 'alpha(opacity=0)' }, 1000)

关于jquery - 在 IE 中使用 Jquery 动画不透明度时,图像会被剪裁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2544664/

相关文章:

javascript - 按钮单击事件上动态 ul 的文本框值

javascript - 使用 jQuery 定位多个 div

javascript - 如何保证一个html页面上所有的元素都加载完毕,然后我们在CSS中对元素进行一些修改呢?

swift - 在 Swift 中使 CollectionViewCell 在突出显示时反弹

jquery.animate 背景位置不起作用

jQuery $.animate() 多个元素但只触发一次回调

javascript - 模态未启动 jquery

jquery - 如何检测我的用户何时正在观看视频(也来自外部源)

javascript - .scroll() 无法正常工作

jquery - 简单的 jquery 动画 - 鼠标移动过多的问题