繁体   English   中英

如何在另一个 html 页面中使用引导模式?

[英]How I can use bootstrap Modal in another html page?

任何人都知道如何另一个 html 页面中使用引导模式,该页面是在第一个 html 页面中创建的

我想你可以做一个小技巧。 您可以将模态存储在一个变量中并将其注入到 DOM 中。

例子:

const modalTrigger = `
        <button type="button" class="btn btn-primary" data-toggle="modal" 
           data-target="#exampleModalCenter">
          Launch demo modal
        </button>`


const modal = `
        <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
      <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            ...
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary">Save changes</button>
          </div>
        </div>
      </div>
    </div>
`

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM