jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了JQuery:animate()在IE中没有按预期工作大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我对这个IE 7感到疯狂……

==> hhttp://neu.emergent-innovation.com/

为什么以下功能在IE 7中不起作用,但与Firefox完全兼容?动画功能中是否有错误

function accordion_starTing_page(){
    // hide all elements except the first one
    $('#FCE-Inhalt02-ContentWrapper .FCE-Fade:not(:first)').css("height","0").hide();
    $('#FCE-Inhalt02-ContentWrapper .FCE-Fade:first').addClass("isVisible");

    $('div.FCE-title').click(function(){

        // if user clicks on an already opened element => do nothing
        if (parseFloat($(this).next('.FCE-Fade').css("height")) > 0) {
            return false;
        }

        var toHide = $(this).siblings('.FCE-Fade.isVisible');

        toHide.removeClass("isVisible");

        // close all opened siblings
        toHide.animate({"height": "0","display": "none"},1000);

        $(this).next('.FCE-Fade').addClass("isVisible").animate({"height" : "200"},1000);

        return false;
    });
}

非常感谢您的帮助…

非常感谢,这些都是很好的提示!不幸的是,它仍然不起作用……

问题是IE@L_674_5@两个容器的内容,直到动画结束…… Firefox表现正常……我认为这是“溢出:隐藏”的事情 – 但这并没有改变任何东西.

我已经尝试过手风琴插件,但它的表现完全一样……

解决方法

如保罗所述,使用该方法时. Animate()jQuery IE7浏览器无法在内部识别属性“position”.例如

CSS规则:

li p (bottom:-178px; color: white; BACkground-color: # 4d4d4d; height: 100%; padding: 30px 10px 0 10px;)

在jQuery中实现动画:

$('li').hover(function(){

              $this = $(this);

              var bottom = '-45px'; //valor default para subir.

              if( $this.css('height') == '320px' ){Bottom = '-115px';}

              $this.css('cursor','pointer').find('p').stop().find('.first').hide().end().animate({Bottom: bottom},{queue:false,duration:300});

      },function(){

         var $this = $(this);

         var bottom = '-178px'; //valor default para descer

            if( $this.css('height') == '320px' ){Bottom = '-432px';}

         $this.find('p').stop().animate({***position: 'absolute'***,bottom:bottom},duration:300}).find('.first').show();

      });//fim do hover()

什么在所有浏览器中工作:

CSS规则:

li p (position: absolute; left: 0; bottom:-178px; color: white; BACkground-color: # 4d4d4d; height: 100%; padding: 30px 10px 0 10px;)

JQuery代码

$('li').hover(function(){

                 $this = $(this);

         var bottom = '-45px'; //valor default para subir.

              if( $this.css('height') == '320px' ){Bottom = '-115px';}

              $this.css('cursor',function(){

         var $this = $(this);

         var bottom = '-178px'; //valor default para descer

            if( $this.css('height') == '320px' ){Bottom = '-432px';}

         $this.find('p').stop().animate({Bottom:bottom},duration:300}).find('.first').show();

      });//fim do hover()

就我而言,这是以这种方式解决的.

大佬总结

以上是大佬教程为你收集整理的JQuery:animate()在IE中没有按预期工作全部内容,希望文章能够帮你解决JQuery:animate()在IE中没有按预期工作所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。