package.docs_src.templates.pages.demos.lazyLoad.hbs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of owl.carousel Show documentation
Show all versions of owl.carousel Show documentation
Touch enabled jQuery plugin that lets you create beautiful responsive carousel slider.
The newest version!
---
title: Lazy Load Demo
subTitle: Lazy Load
nav: demos
description: Lazy Load carousel
sort: 1
tags:
- demo
- plugin
---
{{#markdown }}
### Overview
Add lazyLoad to plugin setup:
```
lazyLoad: true
```
LazyLoad HTML structure requires `class="owl-lazy"` and `data-src="url_to_img"` or/and `data-src-retina="url_to_highres_img"`.
If you set above settings not on `` but on other DOM element then Owl will load an image into css inline background style.
You can even use picture tags with different sources by adding the `owl-lazy` class to the source tag and a data-srcset attribute.
### Setup
```
$('.owl-carousel').owlCarousel({
items:4,
lazyLoad:true,
loop:true,
margin:10
});
```
### Option
If you want to preload images you can also add the option ```lazyLoadEager``` to the settings object, where the value
indicates how many items to the right (and left, when loop is ```true```) will be pre-loaded.
### HTML:
```
```
{{/markdown }}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy