我正在研究 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/