javascript - .mouseup() and .mousedown() not working with .mousemove() -


for reason, .mouseup() event not being called. ideally i'd console.log when user activates mouseup().

would know wrong?

http://jsfiddle.net/cbh3b/

$('.circle').mousedown(function () {     console.log('mousedone');     $(document).mousemove(function (e) {         console.log(e.pagey);         $('.circle').offset({             left: e.pagex,             top: e.pagey         });     }); });  $('.circle').mouseup(function () {     console.log('up'); });  var p = $('.square').position(); console.log(p.left); 

you moving circle away cursor once mousedown event triggered. time mouse button moved up, cursor no longer on circle, means $('.circle').mouseup event not called.

if keep circle under mouse mouseup event captured. (see jsfiddle demo.)


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Why won't my code write to SQL? -

c# - Avoiding duplicate methods for Task and Task<T> -