search
HomeWeChat AppletMini Program DevelopmentWeChat Mini Program Example: Implementing 3D carousel special effects code

WeChat Mini Program Example: Implementing 3D carousel special effects code

Aug 29, 2018 am 09:46 AM
javascriptWeChat appletcarousel

This article brings you an example of a WeChat applet: the code to implement 3D carousel special effects. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

When writing the WeChat applet, I wrote about the effect of achieving a 3D carousel. You can directly use the component swiper that comes with the WeChat applet to achieve it.

The effect diagram is as follows :

WeChat Mini Program Example: Implementing 3D carousel special effects code

1. Relevant attributes of swiper

indicator-dots Whether to display small dots, you can also reset it yourself Set whether the small dot

circular is connected to the sliding, which is to achieve infinite scrolling

The distance between previous-margin and the previous picture

next-margin and the next picture Spacing

autoplay to achieve automatic scrolling

Here we mainly use circular to achieve infinite scrolling, and then add the front and back spacing, and then set the level and transparency of the image. Set the height of the image and container. It’s almost possible

wxml file

<!--carousel/index.wxml-->
<swiper>
  <block>
    <swiper-item>
      <image></image>
    </swiper-item>
  </block>
</swiper>

wxss file

/* carousel/index.wxss */
page{
  background: #f7f7f7f7;
}
.imageContainer{
  width: 100%;
  height: 500rpx;
  background: #000;
}
.item{
  height: 500rpx;
}
.itemImg{
  position: absolute;
  width: 100%;
  height: 380rpx;
  border-radius: 15rpx;
  z-index: 5;
  opacity: 0.7;
  top: 13%;
}
.active{
  opacity: 1;
  z-index: 10;
  height: 430rpx;
  top: 7%;
  transition:all .2s ease-in 0s;
}

JS file

// carousel/index.js
Page({

  data: {
    currentIndex: 0
  },

  onLoad: function (options) {
  
  },
  /* 这里实现控制中间凸显图片的样式 */
  handleChange: function(e) {
    this.setData({
      currentIndex: e.detail.current
    })
  },
})

Related recommendations:

WeChat applet Examples of development of carousel chart function

Sharing of examples of WeChat applet completing carousel chart effects

The above is the detailed content of WeChat Mini Program Example: Implementing 3D carousel special effects code. 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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),