GithubHelp home page GithubHelp logo

Dasiyxi's Projects

- icon -

<head> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>滑动事件Demo</title> </head> <body> <article>上下左右滑动</article> </body> <style> *{ margin: 0; padding: 0; } article{ background-color: #000000; width: 100%; height: 100px; text-align: center; line-height: 100px; color: #FFFFFF; } </style> <script> (function() { var touch = {}; function direction(startX, changeX, startY, changeY) { return Math.abs(startX - changeX) >= Math.abs(startY - changeY) ? (startX - changeX > 0 ? 'Left' : 'Right') : (startY - changeY > 0 ? 'Up' : 'Down') } document.getElementsByTagName('body')[0].addEventListener('touchstart', function(e) { touch.startY = e.targetTouches[0].pageY; touch.startX = e.targetTouches[0].pageX; //console.log("点击时的X坐标" + nStartX + "和Y坐标" + nStartY); }); document.getElementsByTagName('body')[0].addEventListener('touchmove', function(e) { touch.whenChangY = e.changedTouches[0].pageY; touch.whenChangX = e.changedTouches[0].pageX; //console.log("滑动时的X坐标" + nWhenChangX + "和Y坐标" + nWhenChangY); }) document.getElementsByTagName('body')[0].addEventListener('touchend', function(e) { touch.changY = e.changedTouches[0].pageY; touch.changX = e.changedTouches[0].pageX; //console.log("滑动后的X坐标" + nChangX + "和Y坐标" + nChangY); var swDirection = direction(touch.startX, touch.changX, touch.startY, touch.changY); console.log(swDirection); }) })() </script>

cv icon cv

:see_no_evil:《切图仔面试宝典》

github-emoji icon github-emoji

:dog:基于Vue编写的Github表情包大全 Writing based on Vue for github emoji

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.