Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2009, 04:05 PM   PM User | #1
Gravista
New to the CF scene

 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Gravista is an unknown quantity at this point
Fast clicks on nav menu prompt fadeIn() of multiple divs

I'm having an issue with a script (my first try at jQuery) I wrote to fade in divs using a nav menu. If a user clicks different buttons on the nav menu quickly, it loads both divs over top of each other.

Here is the code:
Code:
$(document).ready(function(){
		
			$("#about-button").css({
				opacity: 0.3
			});
			$("#contact-button").css({
				opacity: 0.3
			});
			$("#friends-button").css({
				opacity: 0.3
			});
			$("#gallery-button").css({
				opacity: 0.3
			});
		$("#container div.button").click(function(){
				$clicked = $(this);
				if($clicked.css("opacity") != "1" && $clicked.is(":not(animated)"))
				{
					$clicked.animate({
						opacity: 1,
					}, 600 );
					var idToLoad = $clicked.attr("id").split('-');
					$("#content").find("div:visible").fadeOut("slow", function(){
						$(this).parent().find("#"+idToLoad[0]).fadeIn("slow")
					})
				}
				$clicked.siblings(".button").animate({
					opacity: 0.3,
				}, 600 );
			});
		});
Is there a way I can disable clicks on the menu until the div is :visible? If someone has an answer for that or another fix, i'd really like to see it! this is the only bug that has been found so far with the site.

Here is the site in question:http://www.drifterproductions.ca
Here is the style sheet:http://www.drifterproductions.ca/styles.css

Thanks!
Gravista is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:42 PM.


Advertisement
Log in to turn off these ads.