Zepto.js不会返回false吗? [英] Zepto.js doesn't return false?
本文介绍了Zepto.js不会返回false吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用zepto.js将事件处理程序绑定到click函数.通常,在JQuery中,我只能说return false,而实际的点击将永远不会发生. Zepto不支持此吗?如果可以,该如何解决?
I'm trying to bind an event handler to a click function using zepto.js. Normally in JQuery I can just say return false and the actual click will never go through. Does Zepto not support this? And if so, how to get around this?
推荐答案
要复制jQuery事件处理程序中返回false的行为,您需要调用 event.stopPropagation()
.
To duplicate the behaviour of returning false in a jQuery event handler you need to call event.preventDefault()
and event.stopPropagation()
.
这篇关于Zepto.js不会返回false吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文