Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em><strong><a href="http://jsfiddle.net/TMTbS/" rel="nofollow"><code>jsFiddle Demo</code></a></em></strong></p> <p>The flickering is a result of the element created causing the mouseout section of hover to be called. This is removing the image element, and once the element is removed, the mouseover section of hover is called, and the image is recreated, along with the call to fadeIn. The animation queue is overloaded in the process and eventually throws an error (<code>Uncaught RangeError: Maximum call stack size exceeded</code>) which will cause extremely inconsistent results.</p> <p>The remedy this, you should keep track of where the mouseover area is with an object:</p> <pre><code>var sp = {}; sp.top = slike.position().top; sp.left = slike.position().left; sp.right = sp.left + slike.width(); sp.bottom = sp.top + slike.height(); </code></pre> <p>and also keep track of the image sizes:</p> <pre><code>var w; var h; </code></pre> <p>which could be filled once appended</p> <pre><code>body.append( image_hover( ) ); w = $(".oglas_slika_velika").width(); h = $(".oglas_slika_velika").height(); </code></pre> <p>Next would be to ensure that the mouse cursor was truly mousing out of the hover region by checking the collision between the created image and the cursor</p> <pre><code>if( e.pageY + h &gt; sp.bottom || e.pageY - h &lt; sp.top){ body.find('.oglas_slika_velika').remove(); }else{ if( e.pageX + w &gt; sp.right || e.pageX - w &lt; sp.left ){ body.find('.oglas_slika_velika').remove(); } } </code></pre> <p>Although this takes slightly more work, it is also a lot more precise and less prone to error. It will allow the image to directly track the mouse instead of being pushed to an offset. </p> <p>If it is not important to have the image directly at the place of the mouse, then @Luigi De Rosa's answer will work very well and require less effort.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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