多数のロジック チェックに基づいて、多数の dom 要素の可視性を制御する必要があります。jquery で次のようなことが本当に必要です。
$('.FirstPanel').visible = (condition == 1 || othercondition == true);
$('.SecondPanel').visible = (condition > 3 || othercondition == false);
$('.ThirdPanel').visible = (condition < 3 || stillanothercondition = 'asdf');
etc
もちろん、if または switch ステートメントを使用して上記のコードを表現して$('.FirstPanel').hide()
... を呼び出すことはできますが、それには何倍ものコード行数が必要になります。
if(condition == 1 || othercondition == true) {
$('.FirstPanel').show();
$('.SecondPanel').hide();
$('.ThirdPanel').hide();
} else if (condition > 3 || othercondition == false) {
$('.FirstPanel').hide();
$('.SecondPanel').show();
$('.ThirdPanel').hide();
} etc
明らかな何かが欠けているように感じます。ありがとう
2012.09.24 更新
皆さんの回答に感謝します-トグルメソッドはチケットです(以下のMichaëlWitrantの受け入れられた回答を参照してください)