【问题标题】:bootstrap modal is not working. I have made sure everything is okay but still not working引导模式不起作用。我已确保一切正常但仍无法正常工作
【发布时间】:2018-08-07 00:55:08
【问题描述】:

这是我的代码

<a href="#logout" data-toggle="modal" data-target="#logout"><i class="fa fa-sign-out"></i>&nbsp;Logout</a><!--link to the modal-->

这里是模态

<!--the pop up box to look like this-->
<div class="modal fade" id="logout" role="dialog">
    <div class="modal-body">
     <div class="alert alert-error">Are you sure you want to Logout?</div>
    </div>
    <div class="modal-footer">
     <button class="btn" data-dismiss="modal" aria-hidden="true"><i class="fa   fa-remove"></i>&nbsp;NO</button>
     <a href="logout.php" class="btn btn-danger"><i class="fa fa-check">   </i>&nbsp;Yes</a>
    </div>
</div><!--end modal-->

【问题讨论】:

    标签: html twitter-bootstrap modal-dialog


    【解决方案1】:

    引导 CDN CSS

    https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
    

    JS

    https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
    

    用按钮触发模态

     <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#logout">modal window</button>
    

    模态

    <div class="modal fade" id="logout" role="dialog">
        <div class="modal-body  modal-lg">
         <div class="alert alert-error">Are you sure you want to Logout?</div>
        </div>
        <div class="modal-footer">
         <button class="btn" data-dismiss="modal" aria-hidden="true"><i class="fa   fa-remove"></i>&nbsp;NO</button>
         <a href="logout.php" class="btn btn-danger"><i class="fa fa-check">   </i>&nbsp;Yes</a>
        </div>
    </div>
    

    javascript ,如果想用 javascript 做更多的改变。但没有它也能正常工作。

     $(document).ready(function ()  
              {
    
                  $('#modal_name').modal({
                      show: false,
                      backdrop: 'static',
                      keyboard: false
                    });
              });
    

    JS 小提琴 Check this fiddle, It's Your Code

    我猜,你使用的是低版本的 jQuery,使用这个。它会工作jQuery CDN

    【讨论】:

    • 我也做了同样的事情......但到目前为止什么都没有......我已经包含了所有必要的引导和 jquery 文件,但它不起作用
    • 好的,只要放置这个模态窗口。并测试它。并放置一个引导程序和 jquery 的 CDN.. 然后让我们知道。
    【解决方案2】:

    你的脚本是这样排列的吗:

    <!-- MAKE SURE JQUERY IS BEFORE BOOTSTRAP -->
    <script src="/path/to/jquery/"></script>
    <script src="/path/to/bootstrap/"></script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-04
      • 1970-01-01
      • 2019-09-04
      • 2022-01-08
      • 1970-01-01
      相关资源
      最近更新 更多