if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { (($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false // fix for BS 3.3.6 }
截图发出来呀,这样看起来乱的……
if (!$(this).is(e.target) && $(this).has(e.target).length===0 && $('.popover').has(e.target).length===0) {
(($(this).popover('hide').data('bs.popover')|| {}).inState|| {}).click=false // fix for BS 3.3.6
}
看图片大概意思是,对body 注册一个点击监听。
只要有鼠标点击事件在body 页面上发生,执行click(function() {}) 函数,执行判断条件。
当前点击事件目标 e.target 是否为当控件$(this) 这里应该指代的是data-toggle为 popover tooltip 对应的控件
点击的不是当前控件或者点击事件的目标控件length 为0 就会执行if 下逻辑代码
隐藏当前控件的弹出框,并且点击事件不响应.click = false
上面说的有点乱,根据代码自己在看看
(($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false主要是这句不懂