Home  >  Article  >  WeChat Applet  >  Tutorial on implementing image carousel switching function using WeChat Xiaocheng swiper component

Tutorial on implementing image carousel switching function using WeChat Xiaocheng swiper component

小云云
小云云Original
2017-12-13 09:35:133434browse

This article mainly introduces WeChat Xiaocheng's use of the swiper component to implement the image carousel switching display function, and involves the use of related attributes of the swiper component. I hope it can help everyone.

1. Effect display

##2. Key code

index.wxml:


<swiper indicator-dots="true"autoplay="true" interval="3000" duration="600" style="height:300px;">
 <swiper-item>
 <image src="../../pages/images/img1.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img2.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img3.png" style="display: block;height: 300px;"/>
 </swiper-item>
</swiper>


swiper component attribute description is as follows:


##The change event will be triggered when current changes, event.detail = {current: current, source: source}
Attribute name Type Default value Description Minimum version
indicator-dots Boolean false Whether to display panel indicator dots
indicator-color Color rgba(0, 0, 0, .3) Indicator color 1.1.0
indicator-active-color Color #000000 The currently selected indicator point Color 1.1.0
autoplay Boolean false Whether to switch automatically
current Number 0 The index of the current page
interval Number 5000 Automatic switching interval
duration Number 500 Sliding animation duration
circular Boolean false Whether to use connecting sliding
vertical Boolean false Whether the sliding direction is portrait
bindchange EventHandle

How to use js to implement web page image carousel

JQuery image carousel effect implementation example

jQuery simple custom image carousel plug-in and usage example

The above is the detailed content of Tutorial on implementing image carousel switching function using WeChat Xiaocheng swiper component. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn