When you mousedown
on an image, move the mouse (mousemove
) a little bit and then release (mouseup
), mouseup
is not fired with jQuery.
jsfiddle: http://jsfiddle.net/kVFTZ/
Why is this? How can I make it work when moving on an image?
Easy enough to fix. Add event.preventDefault();
to your mousedown function.
jsFiddle example
$(document).on('mousedown', function(event) {
event.preventDefault();
$('#info').text('Now move the mouse and then release');
$('#log').text('mouse down fired');
}).on('mouseup', function() {
$('#log').text('mouse up fired');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With