javascript - Owl Carousel 2 with lazyload option - Stack Overflow

I'm using Owl Carousel 2 in a project and it's working great.I want to lazyload the images in

I'm using Owl Carousel 2 in a project and it's working great.

I want to lazyload the images in each item. Thankfully, Owl Carousel 2 has a built in option for that. However, there is no option to lazyload the images in the next one or two items (which are not yet in the viewport) preemptively.

Has anyone elso e across this issue or are there any solutions to be offered?

For example, in this demo, four slides are in view. But I would like images in slide 5 and 6 to be loaded pre-emptively. And when you scroll through the carousel, whichever slides are the next two to be shown but not yet visible should also start loading before they bee visible.

I'm using Owl Carousel 2 in a project and it's working great.

I want to lazyload the images in each item. Thankfully, Owl Carousel 2 has a built in option for that. However, there is no option to lazyload the images in the next one or two items (which are not yet in the viewport) preemptively.

Has anyone elso e across this issue or are there any solutions to be offered?

For example, in this demo, four slides are in view. But I would like images in slide 5 and 6 to be loaded pre-emptively. And when you scroll through the carousel, whichever slides are the next two to be shown but not yet visible should also start loading before they bee visible.

Share asked May 3, 2015 at 19:03 VinVin 2,1655 gold badges29 silver badges35 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

You can try to add lazySizes. lazySizes is a third party lazyloader, which detects near the view images automatically and therefore can be used with many sliders without configuration.

In case you want to force a preload you can also add a the class lazypreload.

Here are two examples:

  • lazySizes with flexslider
  • lazySizes with Flickity

Be aware, that you likely need to specify the image dimensions.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744861668a4597739.html

相关推荐

  • javascript - Owl Carousel 2 with lazyload option - Stack Overflow

    I'm using Owl Carousel 2 in a project and it's working great.I want to lazyload the images in

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信