Stream-lining code
Stream-lining code
Hi,
I have this bit of script that opens a slide while closing another, is there a way I can stream-line it so I can us it on a number of elements.
Here's my code:
-
$("#toggle-contact").click(function () {
if ($("#push-contact").is(":hidden")) {
if ($("#push-league").is(":hidden")) {
// $("#push-contact").slideDown("slow");
$("#push-contact").animate({
"height": "toggle", "opacity": "toggle"
}, "slow", function() {var $scrollTo = $.scrollTo({top:'160px'},800);}).end();
} else {
//$("#push-league").slideUp("slow");
$("#push-league").animate({
"height": "toggle", "opacity": "toggle"
}, "slow");
$("#push-contact").delay(1000, function(){
$("#push-contact").animate({
"height": "toggle", "opacity": "toggle"
}, "slow", function() {var $scrollTo = $.scrollTo({top:'160px'},800);}).end();
});
}
} else {
$("#push-contact").animate({
"height": "toggle", "opacity": "toggle"
}, "slow");
}
});
Thanks in advance