document.addEventListener("DOMContentLoaded", () => {
const heroContent = document.querySelector(".hero-content");
const heroContentInner = document.querySelector(".hero-content-inner");
const heroItem = document.querySelectorAll(".hero-content__item");
heroItem.forEach((elem, index) => {
elem.style.width = `${heroContent.getBoundingClientRect().width / heroItem.length + 100}px`;
const heroItemWidth = elem.getBoundingClientRect().width * heroItem.length - 1;
const heroItemHeight = elem.getBoundingClientRect().height * heroItem.length - 1;
const diffOverflowX = heroItemWidth - heroContentInner.getBoundingClientRect().width;
const diffOverflowY = heroItemHeight - heroContentInner.getBoundingClientRect().height;
const cardOffsetX = diffOverflowX / (heroItem.length - 1);
const cardOffsetY = diffOverflowY / (heroItem.length - 1);
const moveX = elem.getBoundingClientRect().width - cardOffsetX;
const moveY = elem.getBoundingClientRect().height - cardOffsetY;
elem.style.transform = `translate(${moveX * index}px ,-${moveY * index}px)`;
});
});
document.addEventListener("DOMContentLoaded", () => {
const heroContent = document.querySelector(".hero-content");
const heroItem = document.querySelectorAll(".hero-content__item");
heroItem.forEach((elem, index) => {
elem.style.width = `${heroContent.getBoundingClientRect().width / heroItem.length}px`;
const form = (heroContent.getBoundingClientRect().height - heroItem[0].getBoundingClientRect().width) / heroItem.length - 1 + 46;
elem.style.transform = `translateY(-${(form * index) / 2}px)`;
});
});
document.addEventListener("DOMContentLoaded", () => {
const heroContent = document.querySelector(".hero-content-inner");
const heroItem = document.querySelectorAll(".hero-content__item");
const offset = 100;
heroItem.forEach((elem, index) => {
elem.style.width = `${heroContent.getBoundingClientRect().width / heroItem.length}px`;
const form = (heroContent.getBoundingClientRect().width - heroItem[0].getBoundingClientRect().width) / heroItem.length - 1;
elem.style.transform = `translateX(${form * index}px)`;
});
});
const heroContent = document.querySelector(".hero-content-inner");
const heroItem = document.querySelectorAll(".hero-content__item");
heroItem.forEach((elem, index) => {
elem.style.width = `${heroContent.getBoundingClientRect().width / heroItem.length}px`;
elem.style.left = `${
(heroContent.getBoundingClientRect().width / 100) * ((100 / heroItem.length) * index) - elem.getBoundingClientRect().width / heroItem.length / 2
}px`;
});