Код: Выделить всё
$('.tag').click(function() {
$(this).toggleClass('active');
updateFilter();
});
function updateFilter() {
$('.filter').toggleClass('active', $('.tag.active').length > 0);
}Код: Выделить всё
.tag.active {
color: red;
}
.filter.active {
color: blue;
}Код: Выделить всё
filter
tag 1
tag 2
tag 3
filter 2
tag 1
tag 2
tag 3
Подробнее здесь: https://stackoverflow.com/questions/786 ... tive-class
Мобильная версия