Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are multiple ways to deal with this, but the one I prefer is after the animation of the initial mouseover completes you check to see if the mouse is still over that item. If it is not you close it back down. </p> <p>jQuery doesn't have a built in check for mouse still over an object that I am aware of, but I wrote one of my own for the situation that is pretty simple. </p> <pre><code>var mouse = { mouseX: null, mouseY: null, mouseInWindow: true, init: function() { $(document).bind('mousemove', function(event) { mouse.mouseX = event.pageX; mouse.mouseY = event.pageY; mouse.mouseInWindow = true; }); $(document).bind("mouseleave", function(event) { mouse.mouseInWindow = false; }); $(document).bind("mouseenter", function(event) { mouse.mouseInWindow = true; }); }, isOver: function($element) { $elementPosition = $($element).offset(); $elementWidth = $($element).width(); $elementHeight = $($element).height(); $returnValue = true; if (mouse.mouseX !== null) { if (mouse.mouseX &lt; $elementPosition.left) { $returnValue = false; } if (mouse.mouseY &lt; $elementPosition.top) { $returnValue = false; } if (mouse.mouseX &gt; $elementPosition.left + $elementWidth) { $returnValue = false; } if (mouse.mouseY &gt; $elementPosition.top + $elementHeight) { $returnValue = false; } if (!mouse.mouseInWindow) { $returnValue = false; } } return $returnValue; } </code></pre> <p>}</p> <p>You will need to run mouse.init() before your other code, but then you can use mouse.isOver($(yourSlideActivator));</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload