It seems that mouseup events are only fired when they are not in conjunction with a mousemove. In other words, push down on the left mouse button and let go, and mouseup is fired. But if you drag across the image and then let go, no mouseup is fired. Here is an example that shows this behavior:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<div id="Out">
<img id="Img" src="http://sstatic.net/so/img/logo.png" width=500>
</div>
<script language=JavaScript>
$(function() {
$(document).bind("mouseup",function() {alert("UP");});
//$("#Out").bind("mouseup",function() {alert("UP");});
//$("#Img").bind("mouseup",function() {alert("UP");});
});
</script>
If you load this, and click and let go, "UP" will alert. However, if you drag and then let go, no UP is fired.
How can I have mouseup fire when mousemove is completed, or how can I inspect the mousemove event to determine that the left mouse button is now off?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…