Develop WeChat applet carousel graphics from scratch (5)

小云云
Release: 2018-03-21 09:52:24
Original
2548 people have browsed it

Swiper is a sliding special effects plug-in for mobile terminals such as mobile phones and tablets. It can realize common effects such as touch screen focus image, touch screen Tab switching, touch screen multi-image switching, etc. It is currently the most widely used touch content sliding plug-in for mobile web pages.

Example:


For more styles, you can view the official API
Reference link: https:/ /mp.weixin.qq.com/debug/wxadoc/dev/component/swiper.html?t=1475052054228

Step 1: WXML file:

<swiper indicator-dots="{{indicatorDots}}"
 autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
 <block wx:for="{{imgUrls}}" wx:key="unique">
  <swiper-item>
   <image src="{{item}}" class="slide-image"/>
  </swiper-item>
 </block></swiper>
Copy after login

Step 2: js file :

Page({  data: {
    imgUrls: [      &#39;http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg&#39;,      &#39;http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg&#39;,      &#39;http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg&#39;
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 500,
 
  },
})
Copy after login

Introduce the meaning of the parameters:

   indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 500,
Copy after login

indicator-dots Boolean false Yes

Whether to display the panel indicator dots
autoplay Boolean false Whether to automatically switch
interval Number 5000 Automatic switching time interval
duration Number 500 Sliding animation duration

The above is the detailed content of Develop WeChat applet carousel graphics from scratch (5). 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!