简体   繁体   English

从iframe触发jQuery动画

[英]Triggering Jquery Animation from Iframe

I am working on this page animation. 我正在制作页面动画。 I included iframe in each of the page elements like in the code below: 我将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>

Here tag triggers the page transition. 在这里标签触发页面转换。 Can I trigger the transition inside the iframe? 我可以在iframe中触发转换吗?

Let's say the animation is a function defined inside your iframe. 假设动画是在iframe中定义的功能。 To call it from outside, you could give a name attribute to your iframe (ie name="myIframe" ) and call the function that way: 要从外部调用它,可以为iframe提供一个name属性(即name="myIframe" ),然后以这种方式调用该函数:

window.myIframe.myFunction();

Note: In Chrome, this might not work on local files due to Same Origin Policy rules. 注意:在Chrome中,由于“相同来源策略”规则,这可能不适用于本地文件。 On a server, or using Firefox, there should be no problem. 在服务器上或使用Firefox,应该没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM