javascript - jQuery 从 iframe 弹出图像

标签 javascript jquery iframe

我有一个带有图像的 iFrame,有没有办法使用 jquery 使它们可点击并在 iframe 之外显示它们?

这就是我所拥有的:

    $(".my-image").click(function(e){
        e.preventDefault();
        $(this).find('img').css({
            'width': '600px',
            'position': 'absolute',
            'left': '50%',
            'top': '10px'
        })
    });

但是图像仍然位于 iFrame 内部

最佳答案

如果您 1) 在 iframe 上设置 allowfullscreen (及其各种 vendor 前缀变体),并且 2) 使用固定定位,则可以转义 iframe。

我应该提到浏览器支持很粗略:How widely supported is the iframe attribute "allowfullscreen"?

关于javascript - jQuery 从 iframe 弹出图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23317444/

相关文章:

javascript - Php 将十进制字符串转换为十进制,但保留尾随零

jquery - 为什么我在使用 jquery 加载 google 时收到 HTTP Status 301?

javascript - 输入空白时尝试清除拉斐尔纸

jquery - 是否可以关闭 iframe 内的 beautifulphoto 模式?

javascript - jAlert 可以指向任何链接吗?

javascript - 检查 JavaScript 中的单词是否具有相同的结尾和开头

javascript - jQuery(window).load()第二次没有访问

javascript - 停止 IE/Edge 窗口调整为 iframe 尺寸

javascript - iFrame 中的 SoundCloud 自动播放已停止工作

javascript - 窗口最小化时,计时器 JavaScript 在 Chrome 和 Mozilla 中不运行