Twitter的自举模态不显示远程图像 [英] twitter bootstrap modal not displaying remote image

查看:170
本文介绍了Twitter的自举模态不显示远程图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Twitter引导的模态窗口,加载远程图像

I'm using twitter bootstrap's modal window to load a remote image

<a href="assets/500x300.gif" data-target="#image-preview" data-toggle="modal"><img alt="250x150" src="/assets/250x150.gif"></a>

以下文档

图片未在模态正确渲染

我得到杂乱数据的负载,而不是 -

I get a load of jumbled data instead -

这是怎么回事?我该如何解决?

What's happening? How can I fix?

推荐答案

在使用的href指定模态远程内容,引导使用jQuery的load方法来获取内容,然后粘检索到的内容转换成模态的主体​​元素。总之,它才有意义,当远程的内容(href值)加载HTML或文本。

When using href to specify remote content for a modal, Bootstrap uses jQuery's load method to fetch the content, and then sticks the retrieved content into the modal's body element. In short, it only makes sense when the remote content (the href value) loads HTML or text.

你看到的预计,因为这是同样的事情,如果你打开​​一个文本编辑器中的gif文件会发生,只是粘贴到一个HTML标签。

What you're seeing is expected, as it's the same thing that would happen if you opened the gif file in a text editor, and just pasted it into an HTML tag.

要让它工作,你想要的方式,将href需要指向包含℃的HTML文档; IMG&GT;标签引用您想要的图像中的模式。

To have it work the way you want, the href needs to point to an HTML document that contains an <img> tag that references the image you want in the modal.

这篇关于Twitter的自举模态不显示远程图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆