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

小云云
Release: 2017-12-13 09:35:13
Original
3426 people have browsed it

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>
Copy after login


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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template