gpt4 book ai didi

jquery - 如何在 fancybox 3 iframe 中添加额外内容?

转载 作者:行者123 更新时间:2023-12-01 08:34:07 25 4
gpt4 key购买 nike

例如我有这个网址

<a data-fancybox data-type="iframe" data-src="/webrtcv2/" href="javascript:;"><i class="fa fa-video-camera" aria-hidden="true"></i></a>

它通常只显示 iframe 的 url,但我需要将此额外的 div 内容添加到 iframe 之外而不是 iframe 内

<div id="video-content" class="video-link" >
<a id="iframelink" class="link-id-videochat" href="">Send invitation</a>
</div>

这是我的 fancybox 3 代码

$(document).ready(function(){

$('[data-fancybox="iframe"]').fancybox({
toolbar : false,
smallBtn : true,
iframe : {
preload : true
}
})
});

最终的结果就是这样 enter image description here

最佳答案

最简单的解决方案是使用 afterLoad 回调来克隆表单并将其附加到内容区域内,例如:

JS

$("#test").fancybox({
afterLoad : function(instance, current) {
current.$content.append( $('#video-content').clone(true).show());
}
})

CSS

.fancybox-slide--iframe .fancybox-content {
max-width: 500px;
max-height: 200px;
}

#video-content {
position: absolute;
top: calc(100% + 20px);
background: #fff;
left: 0;
right: 0;
padding: 5px;
text-align: center;
}

演示 - https://jsfiddle.net/18hbr7oe/

关于jquery - 如何在 fancybox 3 iframe 中添加额外内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58883193/

25 4 0
文章推荐: python - 嵌入 QWidget 时 QListView 选定索引未更新
文章推荐: python - 键盘无法访问元素
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com