var htmlEl = angular.element(document.querySelector('html')); htmlEl.on('click', function (event) { if (event.target.nodeName === 'HTML') { if (myPopup) {//myPopup即为popup myPopup.close(); } } });…
最近项目需要在页面弹窗的时候需要点击弹窗区域外的地方,其实也就是点击页面HTML就可以关闭弹窗, 首先在controller通过js获取到html的dom节点,然后绑定点击事件,话不多说上代码: var htmlEl = angular.element(document.querySelector('html')); htmlEl.on('click', function (event) { if (event.target.nodeName === 'HTML') { if (myPopu…
event.stopPropagation() Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. 点击区域外隐藏该区域Example: <!DOCTYPE html> <html> <head> <meta content="charset=utf-8…
先来看下Android API 的这个Methods: public void setOutsideTouchable (boolean touchable) Controls whether the pop-up will be informed of touch events outside of its window. This only makes sense for pop-ups that are touchable but not focusable, which means to…