大佬教程收集整理的这篇文章主要介绍了jQuery绑定点击* ANYTHING * but * ELEMENT *,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道是否有一个更好的方式来实现这除了以下方法我可以想到…
$(document).bind('click',function(E) { get mouse position x,y get the element (div#special in this casE) position x,y get the element width and height determine if the mouse is inside the element if(insidE) do nothing else do something });
$('#special').on('click',function(E) { e.stopPropagation(); }); $(document).on('click',function (E) { // Do whatever you want; the event that'd fire if the "special" element has been clicked on has been cancelled. });
对于那些使用早于jQuery 1.7的版本(就像这个问题被询问的情况),你将不能使用on();而是简单地将on()
的2种用途替换为bind()
;在这种情况下的签名是相同的。
以上是大佬教程为你收集整理的jQuery绑定点击* ANYTHING * but * ELEMENT *全部内容,希望文章能够帮你解决jQuery绑定点击* ANYTHING * but * ELEMENT *所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。