我正在使用Twitter Bootstrap的模态窗口来加载远程图像。
<a href="assets/500x300.gif" data-target="#image-preview" data-toggle="modal"><img alt="250x150" src="/assets/250x150.gif"></a>
我正在按照这些文档操作
模态框中的图片无法正确显示。
我收到了一堆混乱的数据 -
发生了什么?如何解决?
我正在使用Twitter Bootstrap的模态窗口来加载远程图像。
<a href="assets/500x300.gif" data-target="#image-preview" data-toggle="modal"><img alt="250x150" src="/assets/250x150.gif"></a>
我正在按照这些文档操作
模态框中的图片无法正确显示。
我收到了一堆混乱的数据 -
发生了什么?如何解决?
是的,我也遇到了这个问题。我找到的答案在这里。
我创建了一个链接,就像这样:
<a href="gallery/blue.jpg" class="thumbnail img_modal">
//handler for link
$('.img_modal').on('click', function(e) {
e.preventDefault();
$("#modal_img_target").attr("src", this);
$('#modal').modal('show');
});
//and modal code here
<div id="modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Title to go here</h3>
</div>
<div class="modal-body">
<img id="modal_img_target">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
$("#modal_img_target").attr("src", this);
=>
$("#modal_img_target").attr("src", this.href);
(我没有发表评论的声望)