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

This commit is contained in:
lizanle 2015-07-28 11:20:21 +08:00
parent ad5c4052fb
commit 6b45702f8c
1 changed files with 13 additions and 0 deletions

View File

@ -2,11 +2,24 @@
<script type="text/javascript">
//编辑问卷描述之后
var popWindow ; //弹出框的引用
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
$(function(){
$(document).bind('click',function(e){
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){
popWindow = $("#div_"+quest_type+"_"+quest_id);
$("#div_"+quest_type+"_"+quest_id).click(function(e){
e.stopPropagation();
});
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);