gpt4 book ai didi

javascript - 从 Iframe 触发 Jquery 动画

转载 作者:行者123 更新时间:2023-11-28 09:34:30 25 4
gpt4 key购买 nike

我正在研究 this页面动画。我在每个页面元素中包含了 iframe,如下面的代码所示:

<div class="pt-page pt-page-3">3
<button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button>
<iframe src="file:///E:/Tech%20Nidarshan/Events%20Page/index2.html" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:150;" ></iframe>
</div>
<div class="pt-page pt-page-4">4
<button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button>
</div>
<div class="pt-page pt-page-5">5
<button class="pt-trigger" data-animation="50" data-goto="-1">Go to next page</button>
</div>

这里标签触发页面转换。我可以在 iframe 中触发转换吗?

最佳答案

假设动画是在您的 iframe 中定义的函数。要从外部调用它,您可以为您的 iframe 提供一个 name 属性(即 name="myIframe")并以这种方式调用该函数:

window.myIframe.myFunction();

注意:在 Chrome 中,由于同源策略规则,这可能不适用于本地文件。在服务器上,或者使用 Firefox,应该没有问题。

关于javascript - 从 Iframe 触发 Jquery 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25593597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com