Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 jQuery 编写一个幻灯片应用程序(单击一个按钮,然后您可以在图像列表中滑动),但是我遇到了一个小错误,click()即使在动画期间它也会响应请求正在发生。我已经在使用该animate()功能,所以这并没有阻止额外的动画请求。
click()
animate()
有什么办法可以解决这个问题吗?
您可以在处理程序中检查动画是否正在进行中click:
click
if ($(this).is(':animated')) return false;
或者,您可以使用live或delegate函数仅将处理程序绑定到非动画元素:
live
delegate
$('something:not(:animated)').live('click', function() { ... });