function filterByCategory(cat) {
const dataCats = $("[data-cat]");
if (cat == 'all') {
dataCats.removeClass("hide");
} else {
dataCats.each(function () {
if (cat == $(this).data('cat')) {
$(this).removeClass('hide');
} else {
$(this).addClass('hide');
}
});
}
}
$(function () {
const worksSlider = $('[data-slider="slick"]');
/* Filter
=====================*/
const filter = $("[data-filter]");
filter.on("click", function (event) {
event.preventDefault();
const cat = $(this).data('filter');
filterByCategory(cat);
});
filterByCategory('female');
});
$(function() {
const worksSlider = $('[data-slider="slick"]');
/* Filter
=====================*/
let filter = $("[data-filter]");
filter.on("click", function(event) {
event.preventDefault();
changeBlocksVisibility($(this).data('filter'))
});
});
$().ready(() => changeBlocksVisibility("female"));
function changeBlocksVisibility(cat = 'all') {
if(cat == 'all') {
$("[data-cat]").removeClass("hide");
} else {
$("[data-cat]").each(function() {
let workCat = $(this).data('cat');
if(workCat != cat) {
$(this).addClass('hide');
} else {
$(this).removeClass('hide');
}
});
}
}