代码之家  ›  专栏  ›  技术社区  ›  Raja

在IE中使用jquery animate opacity时,图像会被剪切。

  •  2
  • Raja  · 技术社区  · 15 年前

    我使用下面给出的函数:

    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');
    
            };
    

    它可以进行图像的幻灯片放映。它在火狐和谷歌Chrome上运行得很好,但它会将图片剪辑到IE7和IE8中。任何帮助都非常感谢。

    事先谢谢。

    1 回复  |  直到 13 年前
        1
  •  0
  •   Victor    13 年前

    您使用的是哪个版本的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)