我做了一个消息框,上面有两个按钮。基本上它是一个 jQuery 插件,具有叠加效果的弹出窗口。但是当出现消息框并且用户按下选项卡按钮时,消息对话框不会聚焦。那么如果我的消息框出现,我该怎么做,然后焦点自动转到我的消息框?并且当焦点丢失并且用户再次按下选项卡按钮时,它再次返回到我的消息对话框如果我用鼠标单击消息框然后按下选项卡按钮,那么焦点来到按钮然后消失。这是图像。这是制作盒子的代码。
var containerDiv = $("<div></div>", {
id: config.containerDivID
});
// append all the div to main Div(container)
containerDiv.append(messageDiv, buttonDiv);
centerPopup(config, containerDiv);
loadPopup(config);
function centerPopup(config, container){
var backgroundPopup = $("<div></div>", {
id: "backgroundPopup"
}); //end of imageDiv
$("body").append(backgroundPopup);
$("body").append(container);
$("#backgroundPopup").css({
"height": windowHeight
});
} //end of centerPopup()
function loadPopup(config){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#" + config.containerDivID).fadeIn("slow");
popupStatus = 1;
} //end of if
} //end of function loadPopup()
谢谢