[英]Zurb Foundation Orbit: lazy-loading?
I'm very happy with orbit , the image slider of foundation , but it doesn't support lazy-loading out of the box.我对基础的图像滑块轨道非常满意,但它不支持开箱即用的延迟加载。 I know Interchange , but that's not what I'm looking for.
我知道Interchange ,但这不是我要找的。
I found this discussion with a fork as a solution.我用叉子找到了这个讨论作为解决方案。 I'd like to avoid a fork and prefer to extend the code, to keep my files upgradeable .
我想避免分叉并更喜欢扩展代码,以保持我的文件可升级。
There's no event like on('before-init.fndtn.orbit')
.没有像
on('before-init.fndtn.orbit')
这样的事件。
Does anyone know, how to fix this issue?有谁知道,如何解决这个问题?
Thanks in advance!提前致谢!
I switched to slick , because there was no proper way to use orbit with lazy loading out of the box, the time i asked this question.我切换到slick ,因为在我问这个问题的时候,没有正确的方法来使用带有开箱即用延迟加载的轨道。
A few months later I'm still happy with slick.几个月后,我仍然对 slick 感到满意。
<img data-lazy="img/lazyfonz1.png"/>
$('.lazy').slick({
lazyLoad: 'ondemand',
slidesToShow: 3,
slidesToScroll: 1
});
It probably depends on your exact use case, but I was able to do it like this:这可能取决于您的确切用例,但我能够这样做:
data-orbit
from the orbit container, to prevent it from auto-initializing: <div class="orbit" role="region" aria-label="my gallery">
data-orbit
,以防止它自动初始化: <div class="orbit" role="region" aria-label="my gallery">
data-src
: <img class="orbit-image" data-src="/path/to/image.jpg" alt="description">
data-src
: <img class="orbit-image" data-src="/path/to/image.jpg" alt="description">
data-orbit
attribute, and re-initialize foundation for the orbit container.data-orbit
属性,并重新初始化轨道容器的基础。 $gallery.find('.orbit').attr('data-orbit', '').foundation();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.