无法让简单的引导模式工作

Can not get a simple bootstrap modal to work(无法让简单的引导模式工作)
本文介绍了无法让简单的引导模式工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让一个简单的引导程序的模态样本工作,我遵循 this document 其中说您可以轻松地在页面上激活模态,而无需编写一行 javascript.只需给一个元素一个 data-controls-modal 属性,该属性对应于一个模态元素 id,......",但我已经做了我所做的一切可以并且已经进行了大量研究,但仍然无法使这种简单的模式发挥作用.

I am trying to get a simple bootstrap's modal sample to work, I follow this document which says " You can activate modals on your page easily without having to write a single line of javascript. Just give an element a data-controls-modal attribute which corresponds to a modal element id, ...", but I have done whatever I could and had a huge amount of research still can not get this simple modal to work.

<div class="modal" id="myModal">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>

我有这个:

<a class="btn" data-controls-modal="myModal">Launch Modal</a>

或者这个:

<a class="btn" data-toggle="modal" href="#myModal" >Launch Modal</a>

按钮激活模态,我也在页面上加载了 bootstrap-modal.js.除非我添加了一条 javascript 行来处理Launch Modal"点击事件,否则当我点击Launch Modal"时,什么都没有发生,我错过了什么吗?

button to activate the modal, I have loaded the bootstrap-modal.js on the page as well. Unless I added a javascript line to handle the "Launch Modal" click event, when I click on "Launch Modal", nothing happens at all, are there anything that I have missed?

推荐答案

我终于找到了这个解决方案来自Sven"并解决了这个问题.我所做的是将bootstrap.min.js"包含在:

I finally found this solution from "Sven" and solved the problem. what I did was I included "bootstrap.min.js" with:

<script src="bootstrap.min.js"/>

代替:

<script src="bootstrap.min.js"></script>

它解决了看起来很奇怪的问题.谁能解释一下为什么?

and it fixed the problem which looked really odd. can anyone explain why?

这篇关于无法让简单的引导模式工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)