Answers.Body: <p>This seems more like a jquery issue then a craft issue. You might look into jquery's <code>load</code> method. Doing a quick google search I came up with <a href="https://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe">this possible solution</a>, which you would need to adapt. </p>
  
  <pre><code>function callIframe(url, callback) {
      $(document.body).append('&lt;iframe id="myId" ...&gt;');
      $('iframe#myId').attr('src', url);
  
      $('iframe#myId').load(function() {
          callback(this);
      });
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-21T19:46:40.683Z
Answers.LastActivityDate: 2015-01-21T19:46:40.683Z
Answers.LastEditDate: 2017-05-23T12:38:53.957Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I have a couple of youtube iframes loaded into a channel entry. I also have a script running that resizes those iframes. It appears the script fires on window load but it appears that it fires before the iframes load in from craft. Is there any quick fix to this issue and if so how do I fix it?</p>
  
Tags: <javascript><jquery>
Title: Javascript loads before iframes
ThreadText: # Javascript loads before iframes
  
  (Asked by: username_0 on 2015-01-21)
  
  I have a couple of youtube iframes loaded into a channel entry. I also have a script running that resizes those iframes. It appears the script fires on window load but it appears that it fires before the iframes load in from craft. Is there any quick fix to this issue and if so how do I fix it?
  
  **Tags:** javascript, jquery
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-21. Score: 3
  
  This seems more like a jquery issue then a craft issue. You might look into jquery's `load` method. Doing a quick google search I came up with [this possible solution](https://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe), which you would need to adapt.
  
  ```
  function callIframe(url, callback) {
      $(document.body).append('<iframe id="myId" ...>');
      $('iframe#myId').attr('src', url);
  
      $('iframe#myId').load(function() {
          callback(this);
      });
  }
  
  ```
  
  
  ---
  
  