concurrent execution of event handlers in jquery -


i have horizontal menu in website, , each item in menu have image , sub menu.i write event handler hover. should hide visible sub menu , images before show right image menu. problem when switch between 2 menus rapidly first 1 become visible after handler second 1 execute hide images. , result both images become visible. mess! here code , need prevent execution of function before fadein or slidedown completed. here js code:

 $(function() {      $("#primary-menu li").hover(function(){          if($("#image-menu-"+mlid).is(":visible"))             return  //      hide previous image         $("#sub-menu div").hide()         $('#menu-image img').hide();          var attr = $(this).attr('class');         var mlid = attr.substr('5');           var index = $("#primary-menu li").index(this);                $("#image-menu-"+mlid).fadein(600);          if($("#div-"+mlid).length)             $("#div-"+mlid).slidedown('fast');      });  });  

delay should trick, there examples on @ website.


Comments

Popular posts from this blog

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -