javascript - jquery menu slideshow hover function loading too fast -


i making website includes menu navigation identical 1 found @ fotopunch.com instead of pointing down points up. anyways, wrote code using jquery/javascript menu , works i wondering if there way make hover function doesn't take effect specified amount of time. way when hover on item doesn't cause page load unnecessarily. if has suggestions appreciate it.

below copy of part of code create menu navigation. issue having if hover on many navigation items in row arrow lags behind. hoping creating wait time before hover function takes effect correct issue.

$("div#menu .reps").hover(function() {  if(current_slide != "reps"){     $(".arrow").animate({"left":"135px"});//move arrow     if(current_slide == "clients"){         $(".clients_display").stop(true, true).fadeout().hide();         $(".reps_display").fadein().show();         current_slide = "reps";     }     else if(current_slide == "services"){         $(".services_display").stop(true, true).fadeout().hide();         $(".reps_display").fadein().show();         current_slide = "reps";     }     else{         $(".training_display").stop(true, true).fadeout().hide();         $(".reps_display").fadein().show();         current_slide = "reps";     } } }); 

i think can do, although there better way is:

declare function place code condition:

function hoverfunc(option) {     if($(option).is(':hover'))     {       code show menu     } } 

and on over function do:

$("div#menu .reps").hover(function() {    settimeout("hoverfunc('"+getoptionname+"')",milliseconds); }); 

the idea is: when over, set timeout , when timeout reached, check if mouse on , whatever want, hardest point pass reference function, can pass name of item getting html or rel attribute.

but if dont need reference ease, call function , check element.


there option maybe more interesting you. can add delay effects , add stop(true) before, way, if user change tag fast, events cancelled, change if user goes through option fast , goes out of menu.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -