简体   繁体   中英

Loading iframe before launching .ready();

I have a Facebook comments iframe in the last slide of a carousel. The carousel uses autoHeight to figure out the height of the elements apply it to the slide.

The problem is the comments iframe is loading after the script calculates the height.

How can I load the iframe before the script loads the carousel?

Loading iframe before launching .ready();

Try utilizing $.holdReady()

$.holdReady(true);
// load `iframe`
$("<iframe>").on("load", function() {
  $.holdReady(false)
});

$(function() {
  // do stuff when `iframe` loaded
  // calculate `height`
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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