Javascript 引导-模态isn';行不通
我有这样的模态集Javascript 引导-模态isn';行不通,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我有这样的模态集 <body> <div class="modal fade" id="pageopen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class=
<body>
<div class="modal fade" id="pageopen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
x
</button>
<h4 class="modal-title" id="myModalLabel">
This Modal title
</h4>
</div>
<div class="modal-body">
Add some text here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary"> Submit changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<button onclick="showModal('http://www.google.co.id/')">Show Modal</button>
</body>
x
这是情态标题
在这里添加一些文本
接近
提交更改
显示模态
我只为模式插件添加了最新的jquery、bootstrap js和css。我的问题是,模态背景显示,但是模态标题主体等没有显示
请提供解决方案,谢谢您的问题是
onclick
找不到showmodel
函数,请永远停止在html中使用onclick。这从来都不是一个好的做法。
不要设置按钮的ID,而是使用。单击JQuery中的函数:
<button id="showModal">Show Modal</button>
$("#showModal").click(function(){
$('#pageopen').modal();
});
显示模式
$(“#showmodel”)。单击(函数(){
$('#pageopen').modal();
});
您的Javascript代码错误,要打开Bootstrap 3模式,您应该使用:
$('#pageopen').modal({
show: true
});
如果要加载外部页面,可以在此处设置url:
$('#pageopen').modal({
show: true,
remote: 'http://www.example.com'
});
最好使用jqueryclick函数,而不是“onClick” 哈哈,没关系。对于同一个引导组件,我有单独的js和css,因此它们相互重叠
引导提示:
始终只加载一个js文件和一个css文件进行引导。
如果你和我一样,只想要引导的一部分,而不是所有的包(例如:模态、过渡和旋转木马),那么从getbootstrap将其作为一个js和css按钮如何链接到模态?请转到并查看如何将
引用到正确的模式。还有一篇文章写道,加载iFrame时必须执行的操作<代码>
这是您的按钮或链接的外观。谢谢。这正是我需要的。顺便说一句,我的页面中的问题是因为我为引导加载了两个单独的css,所以模态类彼此重叠,破坏了模态样式。不管怎样,谢谢你的解决方案谢谢你的解决方案。我会记得下次不要使用html事件。