我有一个带有图像的 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/