【问题标题】:Disable hide modal window when click out of the modal jquery单击模态jquery时禁用隐藏模态窗口
【发布时间】:2015-05-09 02:05:27
【问题描述】:

我有一个模态 DIV:

<div class="modal fade" id="window_modal">
  .....
</div>

但是当点击出窗口时,模式窗口关闭,我希望这个窗口只使用模式窗口内的关闭按钮关闭。

【问题讨论】:

    标签: javascript jquery twitter-bootstrap modal-dialog


    【解决方案1】:

    给模态数据属性 background="static"

    例如

    <div class="modal fade" id="window_modal" data-backdrop="static">
      .....
    </div>
    

    全部在这里找到: http://getbootstrap.com/javascript/#modals-usage

    【讨论】:

      【解决方案2】:
      <script type="text/javascript">
          $( document ).ready(function() {
      
          $('#window_modal').on('hide', function (e) {
      
              e.preventDefault();
      
          });
      
       });</script>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-06-23
        • 1970-01-01
        • 2017-08-19
        相关资源
        最近更新 更多