Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created July 13, 2011 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AJFaraday/1080516 to your computer and use it in GitHub Desktop.
Save AJFaraday/1080516 to your computer and use it in GitHub Desktop.
Jquery, first attempt issues
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