问题
I am creating a dynamic modal using javascript. I want to allow the mouse interaction on other background elements buttons, input forms etc on body when modal is open. main line of code for modal is as below.
element1 = document.createElement('div');
element1.setAttribute("id", "myModal");
element1.setAttribute("role", "dialog");
element1.setAttribute("data-keyboard", "false");
element1.setAttribute("data-backdrop", "false");
element1.className = 'modal fade';
document.body.appendChild(element1);
回答1:
Found it it happens that div was covering the entire screen the trick was to change the css from entire body to modal body . also i needed to change the position of modal here is code .
@media screen and (min-width: 768px) {
#fullHeightModalRight {
top : 66px;
left: auto;
bottom: auto;
overflow: visible;
}
}
来源:https://stackoverflow.com/questions/37088897/bootstrap-modal-allow-the-background-interaction-when-modal-open