如何在使用背景时阻止模式出现在页面加载上:'静态'

时间:2016-10-28 12:45:42

标签: javascript jquery html twitter-bootstrap popup

每当我点击一个复选框时,我都会出现一个对话框。但在外面点击或按下转义时不应该消失。所以我使用了背景='静态' ,keyboard =' false'在我的jquery。 但只要我加载或刷新页面,就会出现此对话框。



$('#storeStatusDialog').modal({
    		backdrop: 'static',
    		keyboard: false
})

<div class="container">
    <div class="modal fade" id="storeStatusDialog" role="dialog" >
        <div class="modal-dialog armanlast">
            <div class="modal-content">
                <div class="modal-header">
                    <div class="close-icon-wrap">
                        <a class="modal-close-icon" href="#" data-dismiss="modal">×</a>
                    </div>
                </div>
                
                <div class="modal-body">
                    <h1 class="modal-title1">Deactivate Store</h1>
                    <p class="deactivate-p"></p>
                </div>
                
                <div class="modal-footer">
                    <button type="button" id="noDeactivate" data-dismiss="modal" class="btn btn-default cancel-confirm1 btn-approval1" onclick="statusOnAgain()">Cancel</button>
                    <button type="button" id="yesDeactivate" class="btn btn-default confirm-complete1 btn-approval1"><span style="horizontal-align:middle">Yes</span></button>
                </div>
            </div>
        </div>
    </div>
</div>
&#13;
&#13;
&#13;

请告诉我一种在页面加载时阻止出现对话框的方法。 非常感谢你。

1 个答案:

答案 0 :(得分:0)

HTML:

<div class="container">
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#storeStatusDialog">
    Launch
  </button>

  <div class="modal fade" id="storeStatusDialog" role="dialog">
    <div class="modal-dialog armanlast">
      <div class="modal-content">
        <div class="modal-header">
          <div class="close-icon-wrap">
          <a class="modal-close-icon" href="#" data-dismiss="modal">×</a>
          </div>
        </div>

        <div class="modal-body">
          <h1 class="modal-title1">Deactivate Store</h1>
          <p class="deactivate-p"></p>
        </div>

        <div class="modal-footer">
          <button type="button" id="noDeactivate" data-dismiss="modal" class="btn btn-default cancel-confirm1 btn-approval1" onclick="statusOnAgain()">Cancel</button>
          <button type="button" id="yesDeactivate" class="btn btn-default confirm-complete1 btn-approval1"><span style="horizontal-align:middle">Yes</span>
          </button>
        </div>
      </div>
    </div>
  </div>
</div>

JS:

  $('#storeStatusDialog').modal({
    show: false,
    backdrop: 'static',
    keyboard: false
  })

段:

http://codepen.io/anon/pen/dpEjxK