更改动画速度与jQuery [英] Change animation speed with jQuery

查看:116
本文介绍了更改动画速度与jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $(A)。悬停(函数(){
    $(本).animate({左:'-500px'},'慢');
);

我用这个code动画链接的位置。我把它移动到与动画速度左上角。

我要如何改变这个动画的速度快速,点击链接时?

我们应该:


  • 当链接徘徊慢动画。

  • 快速被点击时它。

问题是,链接已经可以动画,当我们尝试一下就可以了。你觉得呢?

感谢。


解决方案

  $(A)。悬停(函数(){
    $(本).animate({左:'-500px'},'慢');
)。点击(函数(){
    $(本).dequeue()动画({左:'-500px'},'快');
});

$("a").hover(function(){
    $(this).animate({left: '-500px'}, 'slow');
);

I use this code to animate position of the link. I move it to the left corner with slow animation speed.

How do I change speed of this animation to fast, when link is clicked?

We should get:

  • slow animation when link is hovered.
  • fast when it is clicked.

The problem is, link can be already animated, when we try to click on it. What do you think?

Thanks.

解决方案

$("a").hover(function(){
    $(this).animate({left: '-500px'}, 'slow');
).click(function() {
    $(this).dequeue().animate({left: '-500px'}, 'fast');
});

这篇关于更改动画速度与jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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