我如何找出与jQuery如果一个元素被动画? [英] How do I find out with jQuery if an element is being animated?

查看:144
本文介绍了我如何找出与jQuery如果一个元素被动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想移动的页面上的一些元素,期间发生的动画中的时间,我希望能有溢出:隐藏应用到elemnt,而溢出回自动一旦动画完成。

我知道jQuery有确定某个元素是否正在动画,但我不能在任何地方文档找到它的效用函数


解决方案

 如果($(ELEM)。是(:动画')){...}

更多信息 http://docs.jquery.com/Selectors/animated


或者

  $(ELEM)
    的.css(溢出,隐藏)
    .animate({/ *选项* /}函数(){
        //回调函数
        $(本)的.css('溢出','汽车');
    };

I'm trying to move some elements on the page, and during the time the animation occurs, I want to have "overflow:hidden" applied to an elemnt, and "overflow" back to "auto" once the animation is completed.

I know jQuery has an utility function that determines whether some element is being animated but I can't find it anywhere in the docs

解决方案

if( $(elem).is(':animated') ) {...}

More info: http://docs.jquery.com/Selectors/animated


Or:

$(elem)
    .css('overflow' ,'hidden')
    .animate({/*options*/}, function(){
        // Callback function
        $(this).css('overflow', 'auto');
    };

这篇关于我如何找出与jQuery如果一个元素被动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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