Jump to content


Photo

Another Error In The Book? P209


  • Please log in to reply
No replies to this topic

#1 DP76

DP76

    Active Member

  • Members
  • PipPip
  • 43 posts

Posted 26 March 2014 - 01:43 AM

On the verge of chucking this> Is it me? Or the book? P209
The error is...nothing happens when I click on the monsters face.
Can you spot a diffrence between the code here (apart form the lightning fucntions) that is diffrent from the book? If ouo can plaes say where as I can't see it!
Help appreciated
$(document).ready(function() {
	var headclix=0, eyeclix=0, noseclix=0, mouthclix=0;
	lightning_one();
	lightning_two();
	lightning_three();
	
	$("#head").click(function() {
		if (headclix < 9) {
			$(this).animate({left:"-=367px"}, 500);
			headclix += 1;
		}
		else {
			$(this).animate({left:"0px"}, 500);
			headclix = 0;
		}
	});

	$("#eyes").click(function() {
			
			if(eyeclix < 9) {
			$(this).animate({left:"-=367px"}, 500);
			eyeclix += 1;
		}
		else {
			$(this).animate({left:"0px"}, 500);
			eyeclix = 0;
		}
	});

	$("#nose").click(function() {
			
			if(noseclix < 9) {
			$(this).animate({left:"-=367px"}, 500);
			noseclix += 1;
		}
		else {
			$(this).animate({left:"0px"}, 500);
			noseclix = 0;
		}
	});

	$("#mouth").click(function() {
			
			if(mouthclix < 9) {
			$(this).animate({left:"-=367px"}, 500);
			mouthclix += 1;
		}
		else {
			$(this).animate({left:"0px"}, 500);
			mouthclix = 0;
		}
	});
}); //end doc.ready function

	function lightning_one(t) {
		$("#container #lightning1").fadeIn(250).fadeOut(250);
		setTimeout("lightning_one()", 4000);
	};
	function lightning_two(t) {
		$("#container #lightning2").fadeIn("fast").fadeOut("fast");
		setTimeout("lightning_two()", 5000);
	};
	function lightning_three(t) {
		$("#container #lightning3").fadeIn("fast").fadeOut("fast");
		setTimeout("lightning_three()", 7000);
	};




Edited by DP76, 26 March 2014 - 01:45 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users