Vissza a webes elemekhez
Fejlécek

Folyamatos kép

Élő előnézet – a komponens teljes méretben.

Élő előnézet
HTML · CSS · JS
HTML
<div class="we-flow-hero">

    <div class="we-flow-image"></div>
    <div class="we-flow-overlay"></div>

    <div class="we-flow-content">

        <div class="we-flow-index">
            <span>16</span>
            <i></i>
            <span>FOLYAMAT</span>
        </div>

        <h1>
            A világ<br>
            <span>mozgásban.</span>
        </h1>

        <p>
            Vannak pillanatok, amelyeket nem lehet egyetlen
            képkockába zárni.
        </p>

        <a href="#" class="we-flow-button">
            Tovább a történethez
            <span>→</span>
        </a>

    </div>

    <div class="we-flow-side">
        <span>SCROLL</span>
        <i></i>
        <span>01—05</span>
    </div>

    <div class="we-flow-bottom">
        <span>Felfedezés</span>
        <span class="we-flow-bottom-line"></span>
        <span>Új nézőpont</span>
    </div>

</div>
CSS
@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:opsz,wght@6..96,400;6..96,500;6..96,600&family=DM+Sans:wght@400;500;600&display=swap');

.we-flow-hero {
    --we-flow-image:
        url("https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?auto=format&fit=crop&w=2200&q=90");

    position: relative;
    width: 100%;
    min-height: 720px;
    overflow: hidden;
    isolation: isolate;
    background: #080b11;
    color: #fff;
    font-family: "DM Sans", sans-serif;
}

.we-flow-image {
    position: absolute;
    inset: -4%;
    z-index: 0;
    background-image: var(--we-flow-image);
    background-size: cover;
    background-position: center;
    transform: scale(1.06);
    filter: saturate(.72);
    transition: transform 8s cubic-bezier(.22,1,.36,1);
}

.we-flow-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(
            90deg,
            rgba(5,8,13,.9) 0%,
            rgba(5,8,13,.67) 35%,
            rgba(5,8,13,.22) 72%,
            rgba(5,8,13,.48) 100%
        ),
        linear-gradient(
            180deg,
            rgba(5,8,13,.18) 0%,
            transparent 45%,
            rgba(5,8,13,.72) 100%
        );
}

.we-flow-content {
    position: relative;
    z-index: 4;
    width: min(1180px, calc(100% - 120px));
    min-height: 720px;
    margin: 0 auto;
    padding: 80px 0 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;

    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 1.1s ease .4s,
        transform 1.2s cubic-bezier(.22,1,.36,1) .4s;
}

.we-flow-index {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
    color: rgba(255,255,255,.56);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .25em;
}

.we-flow-index i {
    display: block;
    width: 50px;
    height: 1px;
    background: rgba(255,255,255,.4);
}

.we-flow-content h1 {
    margin: 0;
    font-family: "Bodoni Moda", Georgia, serif;
    font-size: clamp(68px, 9vw, 135px);
    font-weight: 400;
    line-height: .87;
    letter-spacing: -.055em;
}

.we-flow-content h1 span {
    display: inline-block;
    color: rgba(255,255,255,.5);
    font-style: italic;
}

.we-flow-content p {
    max-width: 440px;
    margin: 34px 0 36px;
    color: rgba(255,255,255,.72);
    font-size: 15px;
    line-height: 1.8;
}

.we-flow-button {
    display: inline-flex;
    align-items: center;
    gap: 25px;
    padding: 15px 18px 15px 24px;
    border: 1px solid rgba(255,255,255,.4);
    background: rgba(255,255,255,.05);
    backdrop-filter: blur(12px);
    color: #fff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    transition:
        background .35s ease,
        border-color .35s ease,
        transform .35s ease;
}

.we-flow-button span {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: #080b11;
    font-size: 18px;
    transition: transform .4s cubic-bezier(.22,1,.36,1);
}

.we-flow-button:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.8);
    transform: translateY(-3px);
}

.we-flow-button:hover span {
    transform: translateX(5px);
}

.we-flow-side {
    position: absolute;
    z-index: 5;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,.5);
    font-size: 9px;
    letter-spacing: .2em;
    writing-mode: vertical-rl;
}

.we-flow-side i {
    width: 1px;
    height: 75px;
    background: rgba(255,255,255,.4);
}

.we-flow-bottom {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: 30px;
    width: min(1180px, calc(100% - 120px));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    color: rgba(255,255,255,.45);
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.we-flow-bottom-line {
    width: 90px;
    height: 1px;
    background: rgba(255,255,255,.3);
}

.we-flow-hero.is-loaded .we-flow-content {
    opacity: 1;
    transform: translateY(0);
}

.we-flow-hero.is-loaded .we-flow-image {
    transform: scale(1);
}

@media (max-width: 800px) {

    .we-flow-hero {
        min-height: 680px;
    }

    .we-flow-content {
        width: calc(100% - 70px);
        min-height: 680px;
        padding: 70px 0 100px;
    }

    .we-flow-content h1 {
        font-size: clamp(58px, 13vw, 95px);
    }

    .we-flow-side {
        right: 20px;
    }

    .we-flow-bottom {
        width: calc(100% - 70px);
    }
}

@media (max-width: 550px) {

    .we-flow-hero {
        min-height: 650px;
    }

    .we-flow-content {
        width: calc(100% - 45px);
        min-height: 650px;
    }

    .we-flow-content h1 {
        font-size: clamp(52px, 15vw, 76px);
    }

    .we-flow-content p {
        max-width: 330px;
        font-size: 14px;
    }

    .we-flow-side {
        display: none;
    }

    .we-flow-bottom {
        width: calc(100% - 45px);
        bottom: 22px;
    }

    .we-flow-bottom span:last-child {
        display: none;
    }

    .we-flow-bottom-line {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .we-flow-image,
    .we-flow-content,
    .we-flow-button,
    .we-flow-button span {
        transition: none;
    }
}
JavaScript
document.querySelectorAll(".we-flow-hero").forEach(hero => {

    const image = hero.querySelector(".we-flow-image");

    requestAnimationFrame(() => {
        setTimeout(() => {
            hero.classList.add("is-loaded");
        }, 120);
    });

    hero.addEventListener("mousemove", event => {

        const rect = hero.getBoundingClientRect();

        const x = (event.clientX - rect.left) / rect.width;
        const y = (event.clientY - rect.top) / rect.height;

        const moveX = (x - 0.5) * 14;
        const moveY = (y - 0.5) * 9;

        image.style.marginLeft = `${moveX}px`;
        image.style.marginTop = `${moveY}px`;
    });

    hero.addEventListener("mouseleave", () => {

        image.style.marginLeft = "0";
        image.style.marginTop = "0";
    });

});