jQuery转换尚未完成 [英] jQuery transitions don't finish

查看:79
本文介绍了jQuery转换尚未完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我为图像翻转添加了一些过渡:

So I added some transitions to a image rollover:

$(document).ready(function(){
    $('.project').hover(function(){
        $(this).children('.description').stop().slideDown('fast');
    }, function(){
        $(this).children('.description').stop().slideUp('fast');
    });
});

然而,有时说明框只向中间滑动一半,甚至只是其滑动长度的十分之一...说明框为300 x 300px,应该滑入300x300px框...

However sometimes the description box only slide halfway down, or even just 1 tenth of the length it should slide... the description box is 300 by 300px, and is supposed to slide into a 300x300px box...

如果我将鼠标悬停在.project上,这似乎会发生,stop()是否可以将自身添加到队列中,从而在不应该的情况下停止工作?

This seems to happen if I hover over the .project very quickly, could the stop() be adding itself to the queue thus stopping things when it shouldn't?

推荐答案

如果要立即完成动画,请尝试stop( true, true ),如果不想完成动画,请尝试stop( true, false ),将其反转.第一个true将清除队列,以便动画可以重新开始.我不太确定为什么会出错,对于无法给出更完整的答案,我深表歉意,但是现在我无法查找它.不过,您可以在此处了解更多信息: http://api.jquery.com/stop/,我发现jQuery API通常非常有用.

Try stop( true, true ) if you want the animation to be completed immediately or stop( true, false ) if you don't want to complete the animation, just reverse it. The first true will clear the queue so the animation can start over. I'm not completely sure why it's going wrong and I apologize for not being able to give a more complete answer but right now I'm not in the position to look it up. You can read more about it here though: http://api.jquery.com/stop/, I've found the jQuery API usually pretty useful.

这篇关于jQuery转换尚未完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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