点击元素内部不隐藏,点击元素外部元素隐藏

$(document).on("click", function (evt) {
     var oEvent = evt || event;
     var elem = oEvent.target || oEvent.srcElement;
     while (elem) { //循环判断至跟节点,防止点击的是div子元素
         if (elem.id && elem.id=='moreStockBox') {
             return;
         }
         elem = elem.parentNode;
     }
    $scope.chooseStockShow = false;

 });

 

posted @ 2017-09-16 14:33  Sun~_~  阅读(182)  评论(0编辑  收藏  举报