Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to find out if the mouse is over a certain part of an element using jQuery?
    text
    copied!<p>I have a div element that is 980px wide and I'd like to be able to trigger an event if the mouse is in the last 100 pixels or so of the div (I want to slide it). I already know how to slide it, but I haven't been able to make something that tells me when the mouse is either in the first 100pixels so it scrolls left or after the 880 so it can go right. This is my markup:</p> <pre><code>&lt;div class="menuProductosNav"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="computadoras.html"&gt;&lt;img src="assets/img/menuProductos/producto0.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="consumibles.html"&gt;&lt;img src="assets/img/menuProductos/producto11.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="impresoras.html"&gt;&lt;img src="assets/img/menuProductos/producto2.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="apple.html"&gt;&lt;img src="assets/img/menuProductos/producto1.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="productos.html"&gt;&lt;img src="assets/img/menuProductos/producto3.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="redescomu.html"&gt;&lt;img src="assets/img/menuProductos/producto4.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="proyecciones.html"&gt;&lt;img src="assets/img/menuProductos/producto5.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="accesorios.html"&gt;&lt;img src="assets/img/menuProductos/producto6.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="energia.html"&gt;&lt;img src="assets/img/menuProductos/producto7.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="refacciones.html"&gt;&lt;img src="assets/img/menuProductos/producto8.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="software.html"&gt;&lt;img src="assets/img/menuProductos/producto9.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="pdv.html"&gt;&lt;img src="assets/img/menuProductos/producto10.png" alt="" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I honestly am lost at this, could anyone let me know how to do this? all I can get is the element's width:</p> <pre><code>var $nav = $('.menuProductosNav'); $nav.bind('mouseover',function(){ alert($nav.width()); }); </code></pre>
 

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