Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess the <code>mouseout</code> event should be defined outside like this:- </p> <pre><code>$(".menu_account").mouseover(function(){ $("#menu_name").html('first'); $("#menu_name").fadeIn('slow', function(){ }); }); $(".menu_account").mouseout(function(){ $("#menu_name").fadeOut('slow', function(){}); }) </code></pre> <p>That's why the fadeout happens immediately.</p> <p>You could reuse the code like this :-</p> <pre><code>var menuClasses = {'menu_account' : 'first', 'menu_classes' :'second'}; $.each(menuClasses function(index, value) { $("."+value).hover(dothisOnMouseover(value), dothisOnMouseout()) }); $("td").hover( function () { $(this).addClass("hover"); }, function () { $(this).removeClass("hover"); } ); function dothisOnMouseover(value) { $("#menu_name").html(value); $("#menu_name").fadeIn('slow', function(){}); } function dothisOnMouseout() { $("#menu_name").html(''); $("#menu_name").fadeOut('slow', function(){}); } </code></pre> <p><strong>Updates</strong><br> The solution is to somehow check inside <code>dothisOnMouseout()</code> if the <code>fadeIn()</code> has completed already. But I don't know how to do that. So, I have this other trick to enable <code>mouseover</code> only if <code>fadeOut()</code> is complete - </p> <pre><code>function dothisOnMouseover(value) { //Remove the `onmouseover="dothisOnMouseover()" binding of all other menus here - or may be all menus - check it. $("#menu_name").html(value); $("#menu_name").fadeIn('slow', function(){ //On completion of this fade in attach back the `onmouseover="dothisOnMouseover"` event binding all other menus here - Note - do not call `dothisOnMouseout()` here }); } </code></pre> <p>Doing so, if you hover on any menu before the <code>fadeOut()</code> completes, nothing will happen. try it out.</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. VO
      singulars
      1. This table or related slice is empty.
    2. 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