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

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

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

The canvas has been tainted by cross-origin data in chrome only -