title: Javascript: display window on mouseover time interval of 2 seconds
body: <p>I am trying to have a window display when the mouse is hovered over an image for 2 seconds or more, of course if the user does not hover for at least 2 seconds I do not want the window to be displayed. </p>
  
  <p>Below is a snippet of the code that I used. As the code is now the window shows up at two seconds regardless of how long the user hovered over the image. I am trying to get something similar to the delayed hover effect in Netflix. I am sure I am going about it all wrong. So thanks in advance for your help. </p>
  
  <pre><code>&lt;img name="img4" onMouseOver="WindowDelay(this);" onmouseout="closeDetails();" 
          src="images/MyImage.jpg" height="240" width="166"/&gt;
  
  &lt;script language="JavaScript" type="text/javascript"&gt;
         var countTime = 0;
         var windowTimer = null
  
         function WindowDelay(thatImg)
         {
              windowTimer = window.setInterval(function() {countT(thatImg);}, 1000);
         }   
  
         function countT(thatImg)
         {
              countTime++;
  
              if (countTime == 2)
              {
                  openDetails(thatImg);
                  clearInterval(windowTimer);
                  countTime = 0;
              }
  
          }
  &lt;/script&gt; 
  </code></pre>