4、移动端触摸事件

移动端事件

触摸事件touch

屏幕触摸事件,PC端的鼠标移动时是无效的,模拟器时,鼠标点击就会变成触摸事件。允许多点触控,事件触发的位置就在touches属性。

var body = document.querySelector('body');
//触摸开始事件
		body.ontouchstart = function (event) {
			console.log(event);
			console.log('触摸开始事件');
		};
		
		//触摸移动事件
		body.ontouchmove = function (event) {
			console.log(event);
			console.log('触摸移动事件');
		};
		
		// 触摸结束事件
		body.ontouchend = function (event) {
			console.log(event);
			console.log('触摸结束事件');
		};
		
		//点击事件
		body.onclick =function (ev) {
			console.log(ev);
			console.log('点击事件');
		}

1、重点掌握三个touch事件

2、touch事件想要获取触碰的位置需要再touches里面获取

3、如何判断触碰事件是什么方向滑动

4理解掌握如何将滑动事件封装到对象中。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值