0
我想让它如此,当用户点击一个按钮时,模态对话框打开,另一个站点在该对话框中加载..我用了一些教程,仍然无法使它工作正确..当前当我点击按钮,屏幕只是有点灰色,但没有对话框出现..任何人都可以看到哪里即将出错?Bootstrap Modal对话框不显示
<a href="www.google.co.uk" class="btn bootpopup" title="This is title" target="popupModal2">Visit site</a>
<div id="popupModal2" class="modal hide fade" tabindex="-1" role="dialog">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Add new Item</h3>
</div>
<div class="modal-body">
<iframe src="" style="zoom:0.60" frameborder="0" height="250" width="99.6%"></iframe>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">OK</button>
</div>
的javascript
$('.bootpopup').click(function(){
var frametarget = $(this).attr('href');
var targetmodal = $(this).attr('target');
if (targetmodal == undefined) {
targetmodal = '#popupModal';
} else {
targetmodal = '#'+targetmodal;
}
if ($(this).attr('title') != undefined) {
$(targetmodal+ ' .modal-header h3').html($(this).attr('title'));
$(targetmodal+' .modal-header').show();
} else {
$(targetmodal+' .modal-header h3').html('');
$(targetmodal+' .modal-header').hide();
}
$(targetmodal).on('show', function() {
$('iframe').attr("src", frametarget);
});
$(targetmodal).modal({show:true});
return false;
});