Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li>What the problem is (that's causing the glitches)</li> </ul> <p>This code (and the use of inClass &amp; outClass) are problematic. You are changing the state of global variables that are used in the event handlers.</p> <pre><code>var inClass, outClass; jQuery('.overlayLink_overlay_fg div').hover(function(){ inClass = jQuery(this).attr('class'); },function(){ outClass = jQuery(this).attr('class'); }); </code></pre> <p>This code assumes that outClass was set by the 'local' div, but coulsd have been set by a neighboring top div</p> <pre><code> var outHandler = function(){ var blue_bg = jQuery(this).find('.overlayLink_overlay_bg'); var divClass = outClass; </code></pre> <ul> <li>how [could] it could be fixed with my current code?</li> </ul> <p>Do not manage this as a single, global variable, try managing it with Isolated mannor.</p> <p>Here is one apprach: I have not tested this code</p> <pre><code> jQuery('.overlayLink_overlay_fg div').hover(function() { jQuery(this).parents('.overlayLink').attr('mouseEnterClass', jQuery(this).attr('class')); }, function() { jQuery(this).parents('.overlayLink').attr('mouseLeaveClass', jQuery(this).attr('class')); }); </code></pre> <p>In your handlers, refrence this new data.</p> <pre><code> var outHandler = function() { var blue_bg = jQuery(this).find('.overlayLink_overlay_bg'); var divClass = jQuery(this).attr('mouseLeaveClass'); .... } </code></pre> <p>this woulod address the global variable issue. I am not sure what will happen if the 'hover' event occurs before the animation completes.</p> <p>EDIT: Fixed issues with code.</p>
    singulars
    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. 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