WeChat applet learning demo: simple picture animation red envelope code

Source: Internet
Author: User
This article mainly introduces in detail the demo of small program learning: simple picture animation red envelope code, which has a certain reference value. interested friends can refer to it.

Var app = getApp (); Page ({data: {userInfo: {}, src: '', coverImg: {hidden: false, top: 0, // the top value of the image above is bottom: 0, // The bottom value of the image below is locked: false // The homepage is displayed and locked}, openPage: app. globalData. openPage = 1? True: false}, resetCoverImg: function () {this. setData ({coverImg: {hidden: false, top: '0', bottom: '0'})}, bindOpenTap: function () {var that = this; if (! That. data. coverImg. locked) {that. setData ({coverImg: {locked: true}); var dis = 0; var timer = setInterval (function () {dis-= 1; that. setData ({coverImg: {top: dis + '%', bottom: dis + '%'})}, 10); setTimeout (function () {clearInterval (timer ); // expand the home page that. setData ({coverImg: {hidden: true, locked: false}) // if (that. data. openPage) {that. goToOpenPage ();} else {that. goToListPage (); }}, 500) ;}, goToListPage: function () {wx. navigateTo ({url :'.. /list/list'})}, goToOpenPage: function () {wx. navigateTo ({url :'.. /open/open'})}, // share onqueue appmessage: function () {app. updateUserInfo ({'type': 0}); return {title: 'preferer Pro', desc: 'preferer Pro', path: 'pages/index/index' }}, onShow: function () {this. resetCoverImg ();}})

The above is the demo for learning small programs: detailed content of the simple picture animation red envelope code. For more information, see other related articles in the first PHP community!

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.