Wednesday, May 16, 2012

Tidy code for a sequence of jQuery animations on different elements?

I'm currently using this code, and it does what I want it to



$('#about-link').click(function() {
$('#login').fadeOut(function(){
$('#about').fadeIn(function() {
$('#about').one('click', function() {
$('#about').fadeOut(function(){
$('#login').fadeIn();
});
});
});
});
return false;
})


However, the amount of nesting there is insane. Is there are way to write this in a less nested way?





No comments:

Post a Comment