简体   繁体   English

文档准备就绪并加载iframe内容后,运行jQuery代码

[英]Run jQuery code once document is ready AND iframe content is loaded

I'm experiencing issues with layout of my website as I am running some jQuery that gets applied once content is loaded / document is ready. 我正在运行一些jQuery,一旦加载内容/准备好文档,该jQuery就会被应用,因此我的网站布局出现问题。 However, it appears that because iframe content gets loaded in after document is ready plugin gets applied before that and screws up some layout of the website. 然而,似乎因为iframe中的内容获取后装入文档准备的插件版本更新前的状态和螺丝了该网站的一些布局。 Is there a method to only execute jQuery code once document is ready AND iframe content is loaded? 是否有一种方法仅在文档准备好并加载iframe内容后才执行jQuery代码?

As iframe is generated by some plugin in wordpress I have little control and can't give it class name nor id. 由于iframe是由wordpress中的某个插件生成的,因此我几乎无法控制,因此无法为其提供类名或ID。 If you need to access it you can do so, like this: .post-comments iframe 如果您需要访问它,可以这样做,例如: .post-comments iframe

$(document).ready(function(){
    $.holdReady(true);
    //init plugin
    $.holdReady(false);
    //other code
});

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

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