jQuery动画只在IE中工作 [英] jQuery animation only working in IE

查看:72
本文介绍了jQuery动画只在IE中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的动画,我在屏幕的一侧有一个选项卡,如果你点击它,它会增加大小。但它只在IE上工作,这里是代码:

I have a very simple animation, were I have a tab at the side of the screen and if you click it, it will increase size. But it´s only working on IE, here is the code:

<script> 
$(function(){
  $("#a-tab > *").focusin(function(){
    $("#a-tab").animate({width:'320px'});
  });
  $("#a-tab > *").focusout(function(){
    $("#a-tab").animate({width:'10px'});
  });
});
</script>

它必须#a-tab& * 因为内部内容

这是我们如何使它与Chrome,Firefox等兼容。

Were is the problema, how can I make it compatible with Chrome, Firefox, etc.

推荐答案

U可以这样尝试sumthin:

U can try sumthin like this:

<script> 
$(function(){
  $("#a-tab > *").focusin(function(){
    $("#a-tab").stop().animate({width:'320px'});
  });
  $("#a-tab > *").focusout(function(){
    $("#a-tab").stop().animate({width:'10px'});
  });
});
</script>

只需在.animate()之前添加.stop我希望工程为u:)

Just add .stop() before .animate(). I hope that works for u :)

这篇关于jQuery动画只在IE中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆