javascript - how to implement mousemove while mouseDown pressed js -


i have implement mouse move event when mouse down pressed.

i need execute "ok moved" when mouse down , mouse move.

i used code

 $(".floor").mousedown(function() {   $(".floor").bind('mouseover',function(){       alert("ok moved!");   }); }) .mouseup(function() {  $(".floor").unbind('mouseover'); }); 

use mosemove event.

from mousemove , mouseover jquery docs:

the mousemove event sent element when mouse pointer moves inside element.

the mouseover event sent element when mouse pointer enters element.

example: (check console output)

$(".floor").mousedown(function () {     $(this).mousemove(function () {         console.log("ok moved!");     }); }).mouseup(function () {     $(this).unbind('mousemove'); }).mouseout(function () {     $(this).unbind('mousemove'); }); 

https://jsfiddle.net/n4820hsh/


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -