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'); });
Comments
Post a Comment