Мне удалось превратить букву p в синюю. Однако у меня возникли проблемы с удалением синего цвета и .active, когда ссылка на тег не активна.
Код: Выделить всё
$('.tag').click(function() {
var clicks = $(this).data('clicks');
if (clicks) {
$(this).addClass('active');
} else {
$(this).removeClass('active');
}
$(this).data("clicks", !clicks);
});
$('.tag').click(function() {
var numActive = $('.active').length
if (numActive > 0) {
$(this).closest('.wrap').find('.filter').addClass('active');
} else {
$(this).closest('.wrap').find('.filter').removeClass('active');
}
})Код: Выделить всё
.tag.active {
color: red;
}
.filter.active {
color: blue;
}Код: Выделить всё
filter
tag 1
tag 2
tag 3
Подробнее здесь: https://stackoverflow.com/questions/786 ... ll-be-bold
Мобильная версия