Background scale in

by Laura Kishimoto

HTML

<div class="wrap" data-background-fade>
    <div class="content">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras molestie massa mauris. Ut venenatis tristique varius. Aliquam viverra diam accumsan turpis suscipit, at accumsan augue finibus.
    </div>
</div>

SCSS

body {
    background-color: black;
    height: 100%;
    width: 100%;
}

.wrap {
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: url(https://picsum.photos/1200/1200/?random);
    background-size: cover;
    background-position: center;
    color: white;
    transition: all 1s;
    
    &.loaded {
        opacity: 1;
        transform: scale(1.02);
    }
}

.content {
    font-size: 4vw;
    max-width: 80vw;
    max-height: 80vw;
    text-align: center;
}

JavaScript

// exaggerated load time to show background fade in
setTimeout(function () {
    $('[data-background-fade]').addClass('loaded');
}, 500);