Swiper.js lazy loading of multiple picture pages lazyloading

Source: Internet
Author: User

Swiper.js Official website: http://www.swiper.com.cn/api/Images/2015/0308/213.html

Set to True to turn on picture lazy loading, making preloadimages invalid.
The src tag of the image will need to be rewritten as DATA-SRC and the class name Swiper-lazy added.
Lazy loading of the background graph increases the property Data-background (3.0.7 start).

Lazyloadinginprevnextamount

Sets the number of slide in advance when the picture is delayed loading. The number must be less than Slidesperview.
The default is 1, 1 slide loading pictures in advance, for example, when switching to the third slide, load the picture in the fourth slide.

Examples of how to use
<script> var myswiper = new Swiper ('. Swiper-container ', {lazyloading:true,lazyloadinginprevnext:true, Lazyloadinginprevnextamount:2,}) </script>

 

Callback

Http://www.swiper.com.cn/api/callbacks/2014/1217/91.html

callback function that executes when swiper transitions from the current slide to another slide. In the case of a touch, this function is not triggered when the slide is released without a transition condition, and Ontransitionstart is available at this time.
The Swiper instance can be accepted as a parameter, and the output Activeindex is the slide index after the transition.

Examples of how to use

 

<script language= "JavaScript" > var myswiper = new Swiper ('. Swiper-container ', {onslidechangestart:function ( Swiper) {      alert (swiper.activeindex);    }}) </script>

  

Swiper.js lazy loading of multiple picture pages lazyloading

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.