Answer the question
In order to leave comments, you need to log in
Mouse position right left?
How to determine where the mouse is moving to the right or to the left?
Ideally, you need a script that if the mouse moves to the right, then moves 2 objects to the left by 100px, if the mouse is to the left, then two objects to the right by 100px
Answer the question
In order to leave comments, you need to log in
(function(d, prevX){
d.onmousemove = function(e){
var tX = e.clientX;
if(tX < prevX){
//Мышь двинулась влево
}else{
//Вправо
}
prevX = tX;
}
})(document, 0);
Subscribe to mousemove
Compare current coordinates with those in the past.
Move something there.
jsfiddle.net/43x34xwd
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question