【问题标题】:Jssor lazy load for iframes用于 iframe 的 Jssor 延迟加载
【发布时间】:2017-05-10 08:30:23
【问题描述】:

我正在使用 Jssor 构建带有 iframe 的幻灯片。在每个 iframe 中都有一个带有自动播放功能的视频(通过 Hype 构建)。为此,我在 jssor 中的空间上构建幻灯片,然后将其导出到 jquery 中,然后在代码中将图像 div 替换为 iframe。我的问题:如何使延迟加载与 iframe 一起使用?由于要使其与图像一起使用,我需要将 scr 替换为 scr2,但是使用 iframe ?... 感谢您的帮助。如果我不能让它工作,所有带有视频的 iframe 会同时加载,它会减慢显示速度......在那里你可以看到幻灯片:http://www.expo.martincoiffier.com/belle_ile-CINEMAGRAPHS-jquery/

【问题讨论】:

  • 哇,干得好!

标签: iframe lazy-loading jssor


【解决方案1】:

我认为您可以将第二张幻灯片中的 iframe 元素的src 属性留空,并监听$JssorSlider$.$EVT_PARK 事件,然后在幻灯片到来后设置src 属性。

jssor_slider1.$On($JssorSlider$.$EVT_PARK,function(slideIndex,fromIndex) {
    if(slideIndex == 1) {  //the second slide parks at the view
        //set src attribute for iframe elements in the second slide
    }
});

参考:http://www.jssor.com/development/reference-api.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-18
    • 1970-01-01
    • 2020-07-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多