title: How to detect when an element over another element in JavaScript?
body: <p>I wrote most of the code... And when the element is "fully" over the other element it works. The problem is that I don't just want it to be true when the element is "fully" over the element, I also want it to be true when the element is partly over the other element.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    element = this.element.getStyles('left', 'top', 'width', 'height');
      elementLeftX = element.left.toInt();
      elementLeftY = element.top.toInt();
      elementRightX = (element.width.toInt() + element.left.toInt());
      elementRightY = (element.top.toInt() + element.height.toInt());
  
      el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el); // Element drop area
      elLeftX = el.left.toInt();
      elLeftY = el.top.toInt();
      elRightX = (el.width.toInt() + el.left.toInt());
      elRightY = (el.height.toInt() + el.top.toInt());
  
     if (((elLeftY &lt;= elementLeftY) &amp;&amp; (elementLeftY &lt;= elRightY)) &amp;&amp; ((elLeftY &lt;= elementRightY) &amp;&amp; (elementRightY &lt;= elRightY))) {
          if (((elLeftX &lt;= elementLeftX) &amp;&amp; (elementLeftX &lt;= elRightX)) &amp;&amp; ((elLeftX &lt;= elementRightX) &amp;&amp; (elementRightX &lt;= elRightX))) {
              return true;
          } else {
              return false;
          }
      } else {
          return false;
      }
  </code></pre>
  
  <p>I am very confused and I have been playing around for a while and I just can't get it to work. </p>