next-cochise/src/utils/initWow.ts

61 lines
1.8 KiB
TypeScript
Raw Normal View History

// @ts-nocheck
2025-02-01 06:57:24 +07:00
/* eslint-disable @typescript-eslint/no-require-imports */
export function init_wow() {
const WOW = require("wow.js");
2025-02-01 06:57:24 +07:00
setTimeout(() => {
/* Wow init */
if (document.body.classList.contains("appear-animate")) {
2025-02-04 15:08:01 +07:00
document.querySelectorAll(".wow").forEach((el) => el.classList.add("no-animate"));
2025-02-01 06:57:24 +07:00
}
2025-02-04 15:08:01 +07:00
const wow = new WOW({
2025-02-01 06:57:24 +07:00
boxClass: "wow",
animateClass: "animatedfgfg",
offset: 100,
live: false,
callback: function (box) {
box.classList.add("animated");
},
});
if (document.body.classList.contains("appear-animate")) {
wow.init();
} else {
2025-02-04 15:08:01 +07:00
document.querySelectorAll(".wow").forEach((el) => (el.style.opacity = "1"));
2025-02-01 06:57:24 +07:00
}
/* Wow for portfolio init */
if (document.body.classList.contains("appear-animate")) {
2025-02-04 15:08:01 +07:00
document.querySelectorAll(".wow-p").forEach((el) => el.classList.add("no-animate"));
2025-02-01 06:57:24 +07:00
}
2025-02-04 15:08:01 +07:00
const wow_p = new WOW({
2025-02-01 06:57:24 +07:00
boxClass: "wow-p",
animateClass: "animatedfgfg",
offset: 100,
live: false,
callback: function (box) {
box.classList.add("animated");
},
});
if (document.body.classList.contains("appear-animate")) {
wow_p.init();
} else {
2025-02-04 15:08:01 +07:00
document.querySelectorAll(".wow-p").forEach((el) => (el.style.opacity = "1"));
2025-02-01 06:57:24 +07:00
}
/* Wow for menu bar init */
if (
document.body.classList.contains("appear-animate") &&
window.innerWidth >= 1024 &&
document.documentElement.classList.contains("no-mobile")
) {
document.querySelectorAll(".wow-menubar").forEach((el) => {
el.classList.add("no-animate", "fadeInDown", "animated");
setInterval(() => {
el.classList.remove("no-animate");
}, 1500);
});
} else {
2025-02-04 15:08:01 +07:00
document.querySelectorAll(".wow-menubar").forEach((el) => (el.style.opacity = "1"));
2025-02-01 06:57:24 +07:00
}
}, 100);
}