Tracking mouse motion during click with JQuery
<p>How do you track mouse motion after mousedown until mouseup using JQuery? Tracking should start when some target element is clicked and continue to mouseup, even when the mouse moves out of the target element.</p>

<pre><code>&lt;div id="some_elt"&gt;
   &lt;div id="target"&gt;
   &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The only way I can think of is binding <code>mousemove</code> to the whole document and invoking my motion handler based on a global flag I set from <code>$("target").mousedown</code> and unset from<code>$("target").mouseup</code>.</p>

<p>Is there a more elegant approach than this?</p>

<p><b>Edit:</b> I think I need to add an extra bit... my target already has <code>draggable()</code> applied to it. I'm trying to make a decent image viewer. I have a viewport <code>div</code> containing a draggable <code>img</code>. I'm trying to do make the image zoomable with something like shift+middle-click, without interfering with the draggable for navigating. Am I going to have to piggyback on stuff that JQuery does under the hood to make draggable work?</p>

<p><b>Edit2:</b> To answer my edit: of course not! JQuery is awesome!</p>
