Home > Web Front-end > JS Tutorial > body text

How to implement mouse dragging in WeChat applet

亚连
Release: 2018-06-23 14:28:44
Original
1848 people have browsed it

This article mainly introduces the WeChat applet to achieve the mouse dragging effect, involving WeChat applet event binding and element attribute dynamic operation related implementation techniques. Friends in need can refer to the following

This article describes the examples WeChat applet implements mouse dragging effect. Share it with everyone for your reference, the details are as follows:

Key code

index.wxml file

<view class="view"
 style="left:{{left}}px;top:{{top}}px;"
 bindtouchmove="viewTouchMove"
 >使用鼠标拖动我</view>
Copy after login

index.js file

Page({
  data:{
    left:&#39;&#39;,
    top:&#39;&#39;
  },
  viewTouchMove:function(e){
    this.setData({
      left:e.touches[0].clientX-60,
      top:e.touches[0].clientY-60
    })
  }
})
Copy after login

The above is what I compiled For everyone, I hope it will be helpful to everyone in the future.

Related articles:

How to use toDoList in Angular

Detailed interpretation of eventbus in vue

How to use WeChat applet to crop the image selection area

How to use Javascript to get the sentence where the selected text is located

The above is the detailed content of How to implement mouse dragging in WeChat applet. 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