I’m a little new to jQuery and javascript.
On my html, I have a div id="test", under which I have div’s like #testone,#testtwo,...
Now if I click on the button #clickme, the fade effect comes, but goes away very soon, even before it reaches #testthree.
I want it to be there until the user clicks somewhere on the document.
Also is there a neater way to do this than to repeat elements?
$( '#clickme' ).click( function() {
$("#test").fadeIn(function(){
$("#testone").show().fadeIn("3000", function(){
$("#testtwo").fadeIn("4500", function(){
$("#testthree").fadeIn("6000", function(){
$("#testfour").fadeIn("7500", function(){
$("#testfive").fadeIn("9000", function(){
return false;
});
});
});
});
});
});
});
$(document).click( function() {
$( '#test' ).hide(1000);
return false;
});
Try this, assuming all your #test, #testone, #testtwo divs are siblings inside a parent container:
Example: http://jsfiddle.net/AlienWebguy/9npvz/2/