<script><br>(function($){<br> $.fn.moveStopEvent = function(callback){<br> return this.each(function() {<br> var x = 0,<br> y = 0,<br> x1 = 0,<br> y1 = 0,<br> isRun = false,<br> si,<br> self = this;
<p> var sif = function(){<br> si = setInterval(function(){<br> if(x == x1 && y ==y1){<br> clearInterval(si);<br> isRun = false;<br> callback && callback.call(self);<br> }<br> x = x1;<br> y = y1;<br> }, 500);<br> }</p>
<p> $(this).mousemove(function(e){<br> x1 = e.pageX;<br> y1 = e.pageY;<br> !isRun && sif(), isRun = true;<br> }).mouseout(function(){<br> clearInterval(si);<br> isRun = false;<br> });<br> });<br> }<br>})(jQuery);</p>
<p>$(function(){<br> $("#div1,#div2").moveStopEvent(function(){<br> alert($(this).attr("id"));<br> }<br> );<br>});<br></script>
div1
div2