mouse move direction

来源:互联网 发布:宏编程鼠标有什么用 编辑:程序博客网 时间:2024/05/15 00:17
currentViewEL.on('mousemove', '.tool-tip', function (event) {if (typeof(last_position.x) != 'undefined') {var deltaX = last_position.x - event.offsetX,deltaY = last_position.y - event.offsetY;if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0) {//lefthoverDirection = 'left';} else if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0) {//righthoverDirection = 'right';} else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0) {//uphoverDirection = 'up';} else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY < 0) {//downhoverDirection = 'down';}}last_position = {x : event.offsetX,y : event.offsetY};});


原创粉丝点击