$(document).click(function (e) {
if (!$(e.target).hasClass('alert-container') && $(e.target).parents('.alert-container').length === 0
&& !$(e.target).hasClass('btn-eco-bell') && $(e.target).parents('.btn-eco-bell').length === 0) {
that.$el.find('#bellDiv').hide();
}
此事件绑定技巧在于alert-container类为弹窗div,btn-eco-bell为点击按钮,如果点击弹窗内部并且不点击按钮,不隐藏弹窗;点击外部或者点击弹框内按钮会隐藏弹窗div。