Hibernate 点击事件与 jQuery 绑定
我的代码类似于以下内容
$(element).click(function() {
$(slider).slide();
});
我想做的是停用点击事件,直到滑动完成(或更准确地说功能完成),以便用户不会滥用它。我怎样才能做到这一点?
I a code similar to the following
$(element).click(function() {
$(slider).slide();
});
What I want to do is to deactivate the click event until the sliding finish (or more precisely the function complete) so that users don't abuse it. How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://jsfiddle.net/samccone/8u2KP/
技巧是检查是否
if (!$('#slider').is(':animated')) {//代码如下}
http://jsfiddle.net/samccone/8u2KP/
The trick is to check if
if (!$('#slider').is(':animated')) {//CODE HERE}
某些东西必须触发滑动,所以停用不是一个选择。相反,您可以在单击时开始滑动,并在幻灯片()的回调函数中执行您需要的任何其他操作:
希望我正确理解您的问题。
PS不太确定jquery是否有slide()效果。它肯定有slideToggle、slideUp 和slideDown,但还没有听说过slide
。请根据您的目的尝试以下代码。
Something has to trigger sliding, so deactivating won't be an option. Instead you could start sliding on click and perform whatever other operations you need to in the slide()'s callback function:
Hope i understood your question right.
P.S. Not quite sure if jquery has slide() effect. It sure has slideToggle, slideUp and slideDown, but haven't heard of slide
Try the below code for your purposes.