Skip to content
Advertisements

JavaScript TEAM CARDS

CODEPEN

JavaScript TEAM CARDS

Github:https://github.com/furkangulsen98/HTML-CSS-JAVASCRIPT/tree/master/JavaScript%20TEAM%20CARDS


HTML CODE

    <div class="container">

        <!-- Box 1 -->
        <div class="box" id="box_1">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p1"></div>
                <h2 class="full_name">Aaron Rossi</h2>
                <div class="jop">CEO & Co-Founder</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>Aaron Rossi</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

        <!-- Box 2 -->

        <div class="box" id="box_2">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p2"></div>
                <h2 class="full_name">George Mitch</h2>
                <div class="jop">UX Designer</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>George Mitch</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

        <!-- Box 3 -->
        <div class="box" id="box_3">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p3"></div>
                <h2 class="full_name">Petty Rossi</h2>
                <div class="jop">Brand Designer</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>Petty Rossi</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

        <!-- Box 4 -->
        <div class="box" id="box_4">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p4"></div>
                <h2 class="full_name">Mitch Rossi</h2>
                <div class="jop">New Business</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>Mitch Rossi</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

        <!-- Box 5 -->
        <div class="box" id="box_5"">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p5"></div>
                <h2 class="full_name">Mitch Petty</h2>
                <div class="jop">Lead Developer</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>Mitch Petty</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

        <!-- Box 6 -->
        <div class="box" id="box_6">
            <div class="front" onclick="frontFunction()">
                <div class="profile_photo p6"></div>
                <h2 class="full_name">Brad Joe</h2>
                <div class="jop">Office Manager</div>
                <ul class="social">
                    <li><i class="fab fa-instagram"></i></li>
                    <li><i class="fab fa-linkedin"></i></li>
                    <li><i class="fab fa-github-square"></i></li>
                </ul>
            </div>
            <div class="back" onclick="backFunction()">
                <h2>Brad Joe</h2>
                <p class="info">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                    Cras rhoncus eget tellus fringilla egestas. Morbi ornare
                    vel augue in maximus. Quisque eget semper sem. Aenean vel
                    tempor leo. Donec ullamcorper tincidunt consectetur. Integer
                    scelerisque fermentum accumsan.
                </p>
            </div>
        </div>

    </div>

CSS CODE

@import url('https://fonts.googleapis.com/css?family=Encode+Sans+Condensed|Yanone+Kaffeesatz');
body {
    padding: 0;
    margin: 0;
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
    background: #fff;
}
.container {
    width: 900px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 300px);
    grid-template-rows: repeat(2,275px);
    /*grid-template-areas:
        "box1 box2 box3"
        "box4 box5 box6"*/
}
.box {
    position: relative;
    perspective: 1000px;
    cursor: pointer
}
.box:hover li{
    opacity: 1;
}
#box_1 {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}
#box_2 {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}
#box_3 {
    grid-column: 3 / 4;
    grid-row: 1 / 2
}
#box_4{
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}
#box_5 {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    text-align: center;
}
#box_6 {
    grid-column: 3 / 4;
    grid-row: 2 / 3
}
.profile_photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 20px auto;
    margin-bottom: -5px
}
.social {
    width: 100px;
    margin: 0 auto;
    position: relative;
    left: -2px;
}
ul li {
    float: left;
    text-decoration: none;
    list-style: none;
    margin-top: 10px;
    margin-right: 10px;
    opacity: 0;
    transition: .3s ease-in-out;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}
ul li:hover{
    transform: scale(1.3);
}
ul li:nth-child(1){
    transition-delay: .1s;
}
ul li:nth-child(2){
    transition-delay: .2s;
}
ul li:nth-child(3){
    transition-delay: .3s;
}
.jop {
    text-align: center;
    font-family: 'Yanone Kaffeesatz', sans-serif;
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
}
h2 {
    text-align: center;
    margin-bottom: 5px;
    font-family: 'Encode Sans Condensed', sans-serif;
    color: #2a2a2a;
    font-size: 20px;
}
.p1 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/rem/128.jpg");
    background-position: center;
    background-size: cover;
}
.p2 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/boheme/128.jpg");
    background-position: center;
    background-size: cover;
}
.p3 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/ok/128.jpg");
    background-position: center;
    background-size: cover;
}
.p4 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/jsa/128.jpg");
    background-position: center;
    background-size: cover;
}
.p5 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/kolage/128.jpg");
    background-position: center;
    background-size: cover;
}
.p6 {
    background-image: url("https://s3.amazonaws.com/uifaces/faces/twitter/tonychester/128.jpg");
    background-position: center;
    background-size: cover;
}
.back {
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    transform: rotateX(-180deg);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    text-align: center;
    font-family: 'Encode Sans Condensed', sans-serif;
    width: 300px;
    height: 275px;
    transition: .5s;
    border: 1px solid rgba(0, 0, 0, 0.05);

}
.front {
    width: 300px;
    height: 275px;
    position: absolute;
    top: 0;
    left: 0;
    padding-top: 35px;
    transform: rotate(0);
    transition: .5s;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    background: #fff;
}
.box.active > .back {
    transform: rotateX(0deg) ;
    top:0;
    left: 0;
    z-index: 99;
}
.box.active > .front {
    transform: rotateX(-180deg);
}
.front:hover {
    z-index: 99;
    border: none;
    box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}
.back h2{
    margin-top: 20px;
}
.back p {
    width: 250px;
    padding-bottom: 8px;
    padding-top: 8px;
    margin: 10px auto 5px auto;
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
    border-top: 2px solid rgba(0, 0, 0, 0.5);
}
@media (max-width: 900px) {
    .container {
        top:200px;
        width: 600px;
        grid-template-columns: repeat(2, 300px);
        grid-template-rows: repeat(3,275px);
    }
    #box_1 {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }

    #box_2 {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }

    #box_3 {
        grid-column: 1 / 2;
        grid-row: 2 / 3
    }

    #box_4 {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    #box_5 {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        text-align: center;
    }

    #box_6 {
        grid-column: 2 / 3;
        grid-row: 3 / 4
    }
}
@media (max-width: 600px) {
    .container {
        margin-top: 900px;
        width: 300px;
        grid-template-columns: repeat(1, 300px);
        grid-template-rows: repeat(6,275px);
    }
    #box_1 {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }

    #box_2 {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    #box_3 {
        grid-column: 1 / 2;
        grid-row: 3 / 4
    }

    #box_4 {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
    }

    #box_5 {
        grid-column: 1 / 2;
        grid-row: 5 / 6;
        text-align: center;
    }

    #box_6 {
        grid-column: 1 / 2;
        grid-row: 6 / 7
    }
}

JS CODE

 let box = document.querySelectorAll(".box");

        function frontFunction() {
            box.forEach((x) => x.addEventListener("click", function () {
                this.classList.add("active");
            }))
        }

        function backFunction() {
            box.forEach((x) => x.addEventListener("click", function () {
                this.classList.remove("active");
            }))
        }
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: