Bootstrap Modal: allow the background interaction when modal open

柔情痞子 提交于 2019-12-10 20:32:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!