javascript - Work out distance moved from mousedown in jQuery -


i want translation x , translation y value through mouse move event in jquery.

when mouse down particular point in page , moving cursor need find translation values how distance moved old point new point. same moving again means need calculate how distance moved previous old point new point.

that means need calculate translatex , translaty. e contains pagex,clientx there no translatex / translatey in jquery ?

thanks,

siva

var bmousedown = false; var opreviouscoords = {     'x': 0,     'y': 0 }  $(document).on('mousedown', function (oevent) {     bmousedown = true;     opreviouscoords = {         'x': oevent.pagex,         'y': oevent.pagey     } });  $(document).on('mouseup', function (oevent) {     bmousedown = false; });  $(document).on('mousemove', function (oevent) {     var odelta;      if (!bmousedown) {         return;     }      odelta = {         'x': opreviouscoords.x - oevent.pagex,         'y': opreviouscoords.y - oevent.pagey     }      opreviouscoords = {         'x': oevent.pagex,         'y': oevent.pagey     } }); 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -