This is the heart of jQuery! You want something like this:
$("#link-that-will-be-clicked").click(function() {
$(".class2,.class3,.class4").fadeOut();
});
To make the solution cleaner, I recommend providing an all divcommon class, for example common-classin addition to class1. So you can:
<div class="common-class class1"></div>
This will allow you to write something simple:
$("#link-that-will-be-clicked").click(function() {
$(".common-class:not(.class1)").fadeOut();
});
And restore everything:
$(".common-class").fadeIn();
source
share