起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2297|回复: 1

[处理中3] wex5与原生js的差别在mousedown或touchstart中如何使用

[复制链接]

13

主题

21

帖子

157

积分

初级会员

Rank: 2

积分
157
QQ
发表于 2019-3-15 11:04:19 | 显示全部楼层 |阅读模式
在原生js 中写mousedown事件中可以再定义mousemove,mouseup事件,在wex5中应该怎么写呢?
document.onmousedown = function(e){
                        var lastX=e.clientX,lastY=e.clientY;
                        this.onmousemove = function(e){
                                console.log(e.clientX,e.clientY);
                                var newX=e.clientX,newY=e.clientY;
                                var dX = newX-lastX,dY=newY-lastY;
                                rY+=dX*0.1,rX-=dY*0.1;
                                wrap.style.transform = "rotateX("+rX+"deg) rotateY("+rY+"deg)"
                                lastX=newX,lastY=newY;
                               
                        }
                        this.onmouseup = function(){
                                console.log("up")
                                this.onmousemove = null;
                               
                        }
                }
发表于 2019-5-14 16:39:01 | 显示全部楼层
找到你添加事件的元素,在它的事件中就有bind-mousedown  等事件
如果是全局,可以在首页   或者最外层加一个div,在div上添加事件即可!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-4-8 07:36 , Processed in 0.053595 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表