title: Javascript mouseleave when mouse is clicked
body: <p>Is there a method to detect the mouseleave while an element is dragged?</p>
  
  <p>I try to drag and drop and element and if it is outside the viewport to show a popup that contains elements from the div.</p>
  
  <p>The mouseleave is fired only when I don;t drag the element, but if I try to drag outside the mouseleave is not fired</p>
  
  <p>So mouse leave without click inside the window works.
  Mouse leave with click doens't work for me.</p>
  
  <pre><code>function verifyMouseLeave(el)
  {
      console.log(document.onmouseleave);
      document.onmouseleave = function(){
          console.log("Mouse Out!");
          isMouseOver = true;
      }
  
      document.onmousedown = function(){
          console.log("Mouse Down!");
          isMouseDown = true;
      }
  
      if(isMouseOver == true &amp;&amp; isMouseDown == true)
      {
          showPopup();
          el.remove();
          isMouseOver =false;
          isMouseDown = false;
      }
  }
  </code></pre>
  
  <p>So I have for example three divs that I want to move them outside the viewport.
  When I begin to drag the div and move it around the window and release it I want it to remain in the same postion as initial. But if I drag it outisde the window I want to remove it from here and show a popup. </p>
  
  <p>Many thanks.</p>