Bootstrap 3 / showing modal doesn#39;t work with the javascript way(Bootstrap 3/显示模式不适用于javascript方式)
问题描述
我使用 Bootstrap 3.0 中的 Modal 功能.
I use the Modal feature from Bootstrap 3.0.
我有这个代码:
<a data-toggle="modal" href="/myNestedContent" data-target="#myModal">
Open the modal containing the content
</a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
//nested content will be inserted here
</div>
当我点击锚点(链接)时,整个作品 => 我看到了带有内容的模式.
When I click on the anchor (the link), the whole works => I see the modal with the content.
但是,当我使用 Javascript 方式(而不是链接)来显示这样的模式时:
However, when I use the Javascript way (instead of the link) to show the modal like this:
$('#myModal').modal('show');
我只看到淡入淡出效果,没有显示模态...
I only see the fade effect without the modal being shown...
当我开始点击链接时,然后调用 javascript,它就可以工作了.(副作用?)
当我通过javascript方式启动时,即使链接只显示淡入淡出效果而没有模态.
可能是.. modal
Javascript 方法的错误?
Might it be .. a bug from the modal
Javascript method?
有关信息,我使用的脚本的声明顺序正确:
For information, the declarations of my scripts that I use are in the right order:
<script src="Ly9jb2RlLmpxdWVyeS5jb20vanF1ZXJ5Lmpz"></script>
<script src="amF2YXNjcmlwdHMvanF1ZXJ5LmZvcm0ubWluLmpz"></script>
<script src="amF2YXNjcmlwdHMvYm9vdHN0cmFwLm1pbi5qcw=="></script>
推荐答案
我不确定我是否误解了你的问题.
i am not sure if i have misunderstood your question.
根据我对你问题的理解,你需要
According to my understanding of your question, you need
$('#myModal').modal({
show: true,
remote: '/myNestedContent'
});
你不能只是
$('#myModal').modal('show');
因为这个js方法中没有提供url.
because there is no url provided in this js method.
这能解决你的问题吗?
这篇关于Bootstrap 3/显示模式不适用于javascript方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Bootstrap 3/显示模式不适用于javascript方式
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Fetch API 如何获取响应体? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01