Detect if user will leave site like Bounce Exchange
<p>Bounce Exchange has figured out an almost perfect way of detecting if a user will leave the website. They do this based on tracking mouse gestures, mouse velocity, and breaking of the browser plane. If they detect someone is leaving they fire off a popup on a lightbox.</p>

<p>I can poorly emulate this, by the following:</p>

<pre><code>$("body").mouseleave(function() {
    jQuery('#avoid-bounce').show();
});
</code></pre>

<p>The only problem is this is rather annoying. Even if it captures someone, the moment they leave the body it fires again.</p>

<p>How probable would it be to factor in mouse speed and allow the event to fire only once? I'm still fairly new to JavaScript and jQuery, but I'm learning.</p>
