为篮子设置动画时禁用链接
我将此脚本用于我的在线购物篮: http:// /www.webresourcesdepot.com/fly-to-basket-effect-with-jquery/。
就像人们在评论中建议的那样,当您多次单击同一张图像时,很容易出现错误。如何在单击一次时禁用 img 链接并在将产品添加到购物篮时重新启用它?
我尝试在函数开头将属性 HREF 设置为 # ,但这没有帮助。
因此,当用户单击该功能时,需要执行该功能,但只要该功能繁忙,就应禁用该链接。
预先感谢您的帮助。
I'm using this script for my online shopping basket: http://www.webresourcesdepot.com/fly-to-basket-effect-with-jquery/.
Like people suggest in the comments it's easy buggy when you click multiple times on the same image. How can I disable the img link when it's clicked once and re-enable it when the product is added to the basket?
I've tried setting the attribute HREF of to # in the beginning of the function, but that doesn't help.
So when a user clicks the function needs to be executed, but the link should be disabled as long as the function is busy.
thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 onclick 处理程序开始时,检查繁忙标志。然后将 busy 标志设置为 true。然后,在 ajax 方法的回调中,将 busy 标志设置回 false。
At the begining of the onclick handler, check for a busy flag. Then set the busy flag to true. Then, in the callback for the ajax method, set the busy flag back to false.