Created
July 13, 2011 15:25
-
-
Save AJFaraday/1080516 to your computer and use it in GitHub Desktop.
Jquery, first attempt issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var title = ['M','A','R','M','I','T','E','J','U','N','C','T','I','O','N'] | |
var index = 0 | |
$(document).ready(function(){ | |
$("body").click(function(){ | |
$("div.jq_test2").html(title[(index%title.length)]); | |
$("div.jq_test2").fadeIn(1); | |
$("div.jq_test2").fadeOut(1000); | |
index=++index | |
}); | |
}); | |
// desired result: when the body of the website is clicked, a letter will appear and then fade out, spelling the title of the website | |
// problem: When the body is clicked during a fade, the letter changes, then the fade finishes and another fade in and out begin. Multiple clicks leave the last letter pulsating until the effects queue is finished | |
// desired solution: either the .html function will wait until the previous | |
fade is finished to change, so the pulsating will continue to spell the title | |
OR | |
The effect queue on the letter is cleared, so the last letter will fade and remain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment