js 得到鼠标的positon 以及相应时间
来源:互联网 发布:上海师范大学网络支付 编辑:程序博客网 时间:2024/04/28 16:22
js 得到鼠标的positon 以及 当前点和上一个点的时间间隔。
<!DOCTYPE html><html><head> <meta charset="utf-8"><!--Created using JS Binhttp://jsbin.comCopyright (c) 2016 by tjcrowder (http://jsbin.com/gejuz/1/edit)Released under the MIT license: http://jsbin.mit-license.org--><meta name="robots" content="noindex"> <title>Example</title> <style> body { height: 3000px; } .dot { width: 2px; height: 2px; background-color: black; position: absolute; } </style></head><body><script>arr = [];date_stamp = 0;cha = 0;function at(){document.write(JSON.stringify(arr));}(function() {"use strict";document.onmousemove = handleMouseMove; function handleMouseMove(event) {var dot, eventDoc, doc, body, pageX, pageY;event = event || window.event; // IE-ism // If pageX/Y aren't available and clientX/Y// are, calculate pageX/Y - logic taken from jQuery// Calculate pageX/Y if missing and clientX/Y availableif (event.pageX == null && event.clientX != null) {eventDoc = (event.target && event.target.ownerDocument) || document;doc = eventDoc.documentElement;body = eventDoc.body;event.pageX = event.clientX +(doc && doc.scrollLeft || body && body.scrollLeft || 0) -(doc && doc.clientLeft || body && body.clientLeft || 0);event.pageY = event.clientY +(doc && doc.scrollTop || body && body.scrollTop || 0) -(doc && doc.clientTop || body && body.clientTop || 0 );}var timestamp = new Date().getTime(); if(!date_stamp){date_stamp = timestamp;}cha = timestamp - date_stamp;if( cha > 200) {date_stamp = timestamp;arr.push([event.pageX,event.pageY,cha]);dot = document.createElement('div');dot.className = "dot";dot.style.left = event.pageX + "px";dot.style.top = event.pageY + "px";document.body.appendChild(dot);} }})(); </script><a id="xx" onclick="at()" href="javascript:void(0)">xxxxxx</a></body></html>
0 0
- js 得到鼠标的positon 以及相应时间
- js 得到鼠标的当前位置
- js得到昨天的时间
- JS得到当前鼠标的坐标
- JS得到当前鼠标的坐标
- js 处理时间,变成相应的格式
- js获取相应的时间端
- JS 得到时间的各个部分
- 得到对象以及鼠标在页面的绝对位置
- 得到对象以及鼠标在页面的绝对位置
- js 得到当前时间
- js 得到当前时间
- Js得到当前时间
- Calendar在时间上加上任意天数(正/负),就可以得到相应的日期
- 鼠标点击相应的demo
- POSITON
- JS中在系统时间上加上多少天以及分别得到当前时间的年、月、日还有sql中的时间问题
- js鼠标悬停时间
- android Tween动画新的理解
- Exception_android_No resource found that matches the given name...
- UI - 关于自动调整内边距问题的细节
- Hive UDF UDTF UDAF 函数
- 【网络】app(retorfit2+RxJava)+javaweb(服务器) retrofit2官方文档实践
- js 得到鼠标的positon 以及相应时间
- Linux运维+系统服务搭建----Could not retrieve mirrorlist
- python杨辉三角
- 关于setpropex工具使用的几点问题记录
- AVPlayerViewController使用总结
- SpringMVC-提高篇-DispatcherServlet-servlet.xml
- 认识包装类
- 自定义View实现圆形进度条(有个点在移动)
- hive中UDF、UDTF、UDAF快速上手