Know your Avatar using your name

Know your Avatar using your name


Hello my friends we going to make an exiting project using API’s(Application programming interface).


For this project I found an amazing API name as joeschmoe i’ll provide you a link so you can use this API in your project.

API=Click Here>>







We make this project using HTML, CSS and JQuery. JQuery is an library of Java Script lets jump into the code


HTML:-

  
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cool Avators using name</title>
    <link rel="stylesheet" href="./style.css">
</head>
 
<body>
    <section>
 
        <div class="container">
            <div class="details">
                <h1>Let's Check your <span>Avators</span> using your Name</h1>
                <input type="text" id="name" placeholder="Enter your name here">
            
            <div class="image">
                <img src="" alt="" class="imageid">
            </div>
            <button>Hit Me!</button>
        </div>
    </div>
</section>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
 
</body>
 

CSS:-


**{

    box-sizing: border-box;

    padding: 0;

    margin: 0;

}

 

body{

    background: linear-gradient(to right,#0200ca  ,#d97ee5);

   font-family:  futura;

   font-style: italic;

   color: white;

    

}

section{

    width: 100%;

    height: 100vh;

    display: flex;

    justify-content: center;

    flex-direction: column;

    align-items: center;

}

.container{

    background-image: url(https://image.freepik.com/free-vector/funky-monkey-mascot_115476-88.jpg);

    background-size: cover;

    background-position: center;

    background-color: oldlace;

    height: 100%;

    width: 100%;

    display: flex;

    justify-content: center;

    align-items: center;

    flex-direction: column;

    height: 600px;

    width: 450px;

    box-shadow: 0px 0px 2px 2px white ;

    border-radius: 20px;

     

}

h1{

    font-size: 50px;

    font-weight: bolder;

}

span{

    color: red;

    animation: span 2s linear infinite alternate ;

}

.details{

    text-align: center;

    background-color: rgb(0,0,0); /* Fallback color */

    background-color: rgba(0,0,0, 0.4);

    height: 100vh;

    border-radius: 20px;

    

}

.details input{

 

    margin-left: 10px;

    width: 350px;

    align-items: center;

    padding: 10px;

}

.details input[type=text]:focus {

    border: 3px solid #555;

  }

 

img{

    padding-top: 10px;

    height: 200px;

    max-width: 200px;

}

button{

    width: 280px;

    padding: 10px 0;

    margin-top: 20px;

    border-radius: 3px;

    color:white;

    font-size: 1.2rem;

    letter-spacing: 2px;

    background-color: red;

    border: none;

    cursor: pointer;

    animation: bg 2s linear infinite alternate;  

}

 

button:hover{

    transform: scale(1.1);

}

@keyframes span {

    0%{

        color:yellow;

    }

    50%{

       color: #db2755;

    }

    100%{

        color: red;

    }

}

@keyframes bg {

    0%{

       background-color:yellow;

    }

    50%{

       background-color:  #db2755;

    }

    100%{

        background-color:  red;

    }

}

 

JQuery:-

 

$(document).ready(function () {

            $('button').click(function () {

                const name = $('#name').val();

                $('.imageid').attr('src', `https://joeschmoe.io/api/v1/random${name}`);

 

            });

        });


Comments