How to use background images with owl carousel

后端 未结 4 1428
感情败类
感情败类 2021-01-19 03:24

I\'d like to use owl carousel with background images rather than tags, like used in http://driveshift.com/car/c10148. However, every example include

4条回答
  •  有刺的猬
    2021-01-19 03:57

    Check out the example code at https://owlcarousel2.github.io/OwlCarousel2/demos/lazyLoad.html

    LazyLoad HTML strucutre 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.

    Therefore, if you use

    instead of , you'll get your desired result.

    Note that you may need to add some CSS to the div for it to look correctly. Hope that helps!

提交回复
热议问题