zoukankan      html  css  js  c++  java
  • 移动端触摸事件简介

    oBox.ontouchend里面放e.changedTouches事件是为了告诉浏览器,刚才谁在这里了,大概是这么个意思。

    1.touches  当前位于屏幕上的所有手指的一个列表
    2.targetTouches  位于当前DOM元素上的手指的一个列表
    3.changedTouches   涉及当前事件的手指的一个列表

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,user-scalable=no">
    <style>
    div{100px;height:100px;background:Red;}
    </style>
    </head>
    <body>
    <div id="box"></div>
    <script>
    var oBox=document.getElementById("box");
    oBox.ontouchstart=function(e)
    {
        //console.log(e.touches);
    };
    oBox.ontouchmove=function()
    {
        //console.log(e.touches);
    };
    oBox.ontouchend=function(e)
    {
        console.log(e.changedTouches);
    };
    </script>
    </body>
    </html>
  • 相关阅读:
    C#学习笔记
    Visual Studio 快捷键
    java 8 中lambda表达式学习
    Spfa算法
    dijkstra算法
    topSort
    并查集--学习详解
    trie树--详解
    POJ1988 并查集的使用
    Mybatis的一级缓存和二级缓存
  • 原文地址:https://www.cnblogs.com/masita/p/4492360.html
Copyright © 2011-2022 走看看