点击空白处可以让弹出框隐藏

This commit is contained in:
lizanle 2015-07-28 16:01:16 +08:00
parent b22f9b221b
commit 90a416fb2f
1 changed files with 9 additions and 2 deletions

View File

@ -7,18 +7,25 @@ function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
$(function(){
//点击空白处
$(document).bind('click',function(e){
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
popWindow.css('display', 'none');
}
//$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
});
})
function chooseQuestionType(quest_type,quest_id){
//quest_type 分为 mc mcq single multi
//quest_id 是quetion的id 下同
if(popWindow){
popWindow.css('display', 'none');
}
popWindow = $("#div_"+quest_type+"_"+quest_id);
$("#div_"+quest_type+"_"+quest_id).click(function(e){
e.stopPropagation();
e.stopPropagation(); //组织冒泡到document.body中去
});
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");