$(function () {
let filter = $("[data-filter]");
filter.on("click", function (event) {
event.preventDefault();
let cat = $(this).data("filter");
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");
}
});
}
});
});
$(".cards__menu_tab li a").click(function (e) {
e.preventDefault();
$(".cards__menu_tab li a").removeClass("cards__menu_list_active");
$(this).addClass("cards__menu_list_active");
});
$(document).ready(function () {
$("ul.bar-section__menu_top").on(
"click",
"li:not(.bar-section__menu_items active)",
function () {
$(this)
.addClass("active")
.siblings()
.removeClass("active")
.closest("div.bar-section__menu_top")
.find("div.bar-section__menu_items")
.removeClass("active")
.eq($(this).index())
.addClass("active");
}
);
});
var target = ".cards__items";
jQuery(target).each(function () {
jQuery(this).click(function () {
location = jQuery(this).find("a").attr("href");
});
jQuery(this).css("cursor", "pointer");
});
$(".cards__popular ul li a").click(function (e) {
e.preventDefault();
$(".cards__popular ul li a").removeClass("active");
$(this).addClass("active");
});
$(".cards__items").click(function (e) {
e.preventDefault();
$(".cards__items").removeClass("cards__items_pinned");
$(this).addClass("cards__items_pinned");
});
var target = "#socialtab";
jQuery(target).each(function () {
jQuery(this).click(function () {
location = jQuery(this).find("a").attr("href");
});
jQuery(this).css("cursor", "pointer");
});
var animateButton = function (e) {
e.preventDefault;
//reset animation
e.target.classList.remove("animate");
e.target.classList.add("animate");
setTimeout(function () {
e.target.classList.remove("animate");
}, 700);
};
var bubblyButtons = document.getElementsByClassName("bubbly-button");
for (var i = 0; i < bubblyButtons.length; i++) {
bubblyButtons[i].addEventListener("click", animateButton, false);
}
var animateButton = function (e) {
e.preventDefault;
//reset animation
e.target.classList.remove("animate");
e.target.classList.add("animate");
setTimeout(function () {
e.target.classList.remove("animate");
}, 700);
};
var bubblyButtons = document.getElementsByClassName("bubbly-blue");
for (var i = 0; i < bubblyButtons.length; i++) {
bubblyButtons[i].addEventListener("click", animateButton, false);
}
Добавить комментарий
|
1 ответ
Gulp/webpack/grunt в помощь
ну или найти какой нибудь онлайн инструмент
как пример есть вот такой ресурс https://javascript-minifier.com