Jquery Animate 的回调函数不起作用

编程入门 行业动态 更新时间:2024-10-25 20:30:37
本文介绍了Jquery Animate 的回调函数不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个 jQuery 动画功能.需要在动画结束后立即执行功能.所以必须使用回调函数.所以我试了一下.没有用,我认为那个特定的功能一定有问题,所以我把它简化为这个......

I have a jQuery animate function. A need to execute a function as soon as animation ends. So gotta use callback function. So I tried it. Didn't work, I thought there must be problem in that particular function so I reduced it to simply this...

phGrp.animate({bottom:0},
              {duration: 1500, easing: 'swing'}, 
              function(){alert('hello')}
);

动画正常工作,没有错误,但回调不会执行.可能是什么问题?我看到了使用匿名函数的解决方案.所以我已经使用了它,但问题仍然存在.

Animation works correctly, no error, but callback won't execute. What can be the problem? I saw a solution of using anonymous function. So I have used it, but still problem persists.

请帮忙

推荐答案

尝试类似下面的操作,检查它是否正常工作

try something like below, check the fiddle it is working

 phGrp.animate({bottom:0},1500,'swing', 
          function(){alert('hello');
         }
 );

小提琴:http://jsfiddle/hYtuP/

参考链接:http://api.jquery/animate/

这篇关于Jquery Animate 的回调函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 08:20:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1038460.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回调   函数   不起作用   Jquery   Animate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!