考えられるすべてのシナリオをコーディングする必要がないように、このコードをより適切に凝縮する方法があるかどうか疑問に思いました。どんな助けでも大歓迎です。
$('select.contactselect').change(function(){
var selectVal = $(this).val();
if(selectVal == 'press'){
$('.support').slideUp('fast');
$('.general').slideUp('fast');
$('.press').delay(100).slideDown('fast', function() {
// Animation complete.
});
}else if (selectVal == 'general'){
$('.press').slideUp('fast');
$('.support').slideUp('fast');
$('.general').delay(100).slideDown('fast', function() {
// Animation complete.
});
}else if (selectVal == 'support'){
$('.press').slideUp('fast');
$('.general').slideUp('fast');
$('.support').delay(100).slideDown('fast', function() {
// Animation complete.
});
}
});