You are first confronted by three links. Each link triggers divs to slide out.
The divs slide out and up to appear as if unfolding. The slide back in reverse when any other link on the page is clicked. The code works exactly how we want it to. However, the code is very long and needs re-developing into a neater script.
To also help further here is the website this script belongs to demo website
$('#menu').click(function () {
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#fatal').css('display') == 'none' ) {
$('#fatal').animate({ left: 'toggle' }, 300, function() {
$('#igna, #black').slideToggle("fast");
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
if ($('#bio-line-1').css('display') != 'none') {
$('#bio-line-2').slideUp("slow");
window.setTimeout(function () {
$('#bio-line-1').animate({ width: 'hide' });
}, 300);
}
$('#contact-info').animate({right: 'hide'});
$('#black-div, #black-credits, #igna-1-div, #igna-1-credits, #igna-2-div, #igna-2-credits, #fatal-div, #fatal-credits').fadeOut('100');
});
$('#igna').click(function () {
if ($('#igna-2').css('display') == 'none') {
$('#igna-2').animate({ left: 'show' }, 300, function() {
$('#igna-1').slideToggle("fast");
});
}
else {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300);
});
}
$('#bio-line-1').animate({width: 'hide'});
$('#contact-info').animate({right: 'hide'});
$('#bio-line-2').slideUp("fast");
$('#black-div, #black-credits, #igna-1-div, #igna-1-credits, #igna-2-div, #igna-2-credits, #fatal-div, #fatal-credits').fadeOut('100');
});
$('#contact').click(function () {
$('#contact-info').animate({right: 'toggle'});
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
if ($('#bio-line-1').css('display') != 'none') {
$('#bio-line-2').slideUp("slow");
window.setTimeout(function () {
$('#bio-line-1').animate({ width: 'hide' });
}, 300);
}
$('#black-div, #black-credits, #igna-1-div, #igna-1-credits, #igna-2-div, #igna-2-credits, #fatal-div, #fatal-credits').fadeOut('100');
});
$('#name-a').click(function () {
if ($('#bio-line-1').css('display') == 'none') {
$('#bio-line-1').animate({ width: 'toggle' });
window.setTimeout(function () {
$('#bio-line-2').slideToggle("slow");
}, 100);
}
else {
$('#bio-line-2').slideToggle("slow");
window.setTimeout(function () {
$('#bio-line-1').animate({ width: 'toggle' });
}, 300);
}
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
$('#contact-info').animate({right: 'hide'});
$('#black-div, #black-credits, #igna-1-div, #igna-1-credits, #igna-2-div, #igna-2-credits, #fatal-div, #fatal-credits').fadeOut('100');
});
$("#black").click(function(){
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
$('#black-div').fadeIn('500');
$('#black-credits').fadeIn('3000');
$('#dust-div, #youth-div, #fatal-div, #hurt-div, #igna-1-div, #igna-2-div, #igna-1-credits, #igna-2-credits, #fatal-credits').fadeOut('100');
});
$("#igna-1 a").click(function(){
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
$('#igna-1-div').fadeIn('500');
$('#igna-1-credits').fadeIn('3000');
$('#dust-div, #black-div, #fatal-div, #hurt-div, #youth-div, #black-credits, #igna-2-div, #igna-2-credits, #fatal-credits').fadeOut('100');
});
$("#igna-2 a").click(function(){
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
$('#igna-2-div').fadeIn('500');
$('#igna-2-credits').fadeIn('3000');
$('#dust-div, #black-div, #fatal-div, #hurt-div, #youth-div, #black-credits, #fatal-credits, #igna-1-div, #igna-1-credits,').fadeOut('100');
});
$("#fatal").click(function(){
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#igna-1').css('display') == 'none' ) {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
} else {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
}
$('#fatal-div').fadeIn('500');
$('#fatal-credits').fadeIn('3000');
$('#dust-div, #youth-div, #black-div, #hurt-div, #igna-1-div, #igna-2-div, #black-credits, #igna-1-credits, #igna-2-credits,').fadeOut('100');
});
var $igna = $('#igna');
and just use$igna
every where else. \$\endgroup\$demo website
link is broken. \$\endgroup\$