Flexslider 中的延迟加载 [英] Lazy Loading in Flexslider

查看:19
本文介绍了Flexslider 中的延迟加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用延迟加载 jquery 插件并遵循本站说明:http://www.appelsiini.net/projects/lazyload

I am trying to get lazy loading working for Flexslider by using Lazy Loading jquery plugin and following the instructions on this site: http://www.appelsiini.net/projects/lazyload

我正在加载插件脚本,但在控制台上没有看到任何错误.我试过没有在lazyload函数中传递容器或选项,但仍然没有.我花了几个小时在这上面.

I am loading the plugin script and don't see any errors on console. I tried without the container or options being passed in lazyload function and still nothing. I spend hours on this.

$("img.lazy").lazyload({
  effect: "fadeIn",
  container: $(".slides > li")
});

有谁知道如何在 Flexslider 中实现延迟加载?

Does anyone know how to get lazy loading working in Flexslider?

推荐答案

所以我将真实图像页面添加到图像标签上的 data-attr 属性中,并在 after 事件触发时找到active 类的图像,并将 img src 属性设置为 data-attr 值.

So I added the real image page to the data-attr attribute on the image tag and on after event fire I would find the image with active class and set the img src attribute equal to data-attr value.

这篇关于Flexslider 中的延迟加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆