• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Help with JQuery animated navigation menu

Turgrid

n00b
Joined
Oct 8, 2007
Messages
20
Hello,

I am not very good with jquery and was wondering how I could improve this simple menu I have made here: [edit: removed]. The menu of concern is the main tabbed menu towards the top left of page. The problem is handling the effects queue. If a user mouses back and forth over the tabs quickly, the tabs exhibit weird behavior as can be demonstrated with linked page. Below is the code utilizing the latest version of JQuery. Thanks in advance for any assistance regarding the improvement of this code.

HTML:
		<script type="text/javascript">
		$(document).ready(function(){
			setupnavtab(".menu-1-1-2","#navbar-girls");
			setupnavtab(".menu-1-2-2","#navbar-boys");
			setupnavtab(".menu-1-3-2","#navbar-babys");
			setupnavtab(".menu-1-4-2","#navbar-diy");
			setupnavtab(".menu-1-5-2","#navbar-rooms");
		});
		var lastselector;
		var timeout;
		function setupnavtab(id, selector) {
			$(id).hover(function(){
				if (lastselector != selector) {
					// $('#navbar-inner').children().hide();
					if (lastselector != null) {$(lastselector).hide();} 
					lastselector = selector;
					$(selector).fadeIn('slow');			
				}
			},function() {});
			$("#navbar").hover(function() {}, function(){
				if(lastselector != null) timeout = setTimeout("$('" + lastselector + "').hide()",500);
				lastselector = null;
			});
		}

	</script>

EDIT: I think I fixed it using a callback function and stopping the previous animations.
 
Back
Top