content logo

Bootstrap Search Boxes:

Bootstrap Search Feild with Animation on Focus

An often-neglected part of each site is the appearance aspect of it. the nicer your website seems at first glance, the more visitors it lures in and the more users you’ll have. One of the main features of your website is the search box and it just so happens to have an effect on its appearance as well. Many people don’t put much effort into it as they think it’s not that important/ they say to themselves, if the search box functions well, then it is enough. They are wrong as a weakly designed Bootstrap search result code does not invite users and instead bores them. No one likes a boring website if they are going to spend more time in it.

To fix this issue we have a great CSS search result code to help you add in a professional animated Bootstrap search box to your website. This beautiful search box uses animation and motion to make your website look a lot cooler. This awesome Bootstrap search box features a normal search icon in the shape of a magnifying glass which opens up into a search bar when it is clicked. You can then type in your desired text and click the search icon once more to o the actual search. A circular animated loading icon will then appear besides the box to indicate that the search is being processed.

#

Bootstrap Search Result

#

CSS Search Result

#

Bootstrap Search

#

Animated Bootstrap Search Box

<!-- This script got from frontendfreecode.com -->
<div class="frame">
        <!-- <div class="circle" data-aos="fade-up" data-aos-easing="ease-out-back"> -->
        <div class="circle">
                <form action="#">
                        <input class="form-control" type="search" name="show" placeholder="Start typing + click button" aria-label="Search" />
                        <div class="btn hide" type="submit" id="show"><i class="fas fa-search"></i></div>
                        <ul class="suggestions clearfix"></ul>
                </form>
        </div>
        <div class="handle"></div>
        <div class="loading hide">
                <i class="fas fa-spinner"></i>
        </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
@import url("https://fonts.googleapis.com/css?family=Overlock");

body {
    background: #201c29 !important;
}

.frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    margin-top: -200px;
    margin-left: -200px;
    border-radius: 2px;
    background: #643a7a;
    box-shadow: 0.5rem 1rem 1rem rgba(0, 0, 0, 0.6);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    align-items: center;
}

form {
    display: flex;
}

.circle {
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    width: 4rem;
    height: 4rem;
    box-shadow: 0.4rem 0.6rem 0.6rem rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: 1s;
    align-items: center;
    justify-content: flex-start;
    background: #643a7a;
    overflow: hidden;
}

.expand {
    width: 15rem;
    border-radius: 0;
}

form {
    width: 15rem;
}

.form-control {
    border: none;
    outline: none !important;
    box-shadow: none !important;
    opacity: 0;
    background: transparent !important;
    font-family: "overlock";
    font-size: 1.2rem;
}

.show {
    opacity: 1;
    transition: 1s;
}

input {
    outline: none;
    border: none !important;
    color: white !important;
}

::-moz-placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* 
.start {
overflow: hidden; /* Hides letters as typing effect happens  
white-space: nowrap; /* Keeps the content on a single line 
margin: 0 auto; /* Gives that scrolling effect as the typing happens 
animation: typing 1.8s steps(40, end);
}
/* The typing effect 
@keyframes typing {
from {
width: 20%;
}
to {
width: 15rem;
}
}
*/
.btn {
    font-size: 125%;
    border-radius: 0;
    padding: 0.5rem;
    z-index: 1000;
    transition: 1s;
}

    .btn i {
        color: white;
    }

    .btn:focus {
        box-shadow: none !important;
    }

.hide {
    opacity: 0;
    z-index: -1;
}

.fa-spinner {
    position: absolute;
    left: 40%;
    top: 30%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 2000%;
    -webkit-animation: loading 3s ease-in-out infinite;
    animation: loading 3s ease-in-out infinite;
}

@-webkit-keyframes loading {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes loading {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.handle {
    position: absolute;
    top: 58%;
    left: 54%;
    background: white;
    box-shadow: 0.5rem 0.5rem 1rem rgba(0, 0, 0, 0.5);
    width: 2rem;
    height: 4px;
    border-radius: 2px;
    transform: rotate(45deg);
    z-index: 1;
    transition: 1s;
}

.tidy {
    transform: translateY(-2rem) rotate(0);
}

form .suggestions {
    border: none !important;
    position: absolute;
    top: 57%;
    left: 20%;
    width: 60%;
    background: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 20px;
    padding: 0 15px;
    margin: 0;
    list-style: none;
    color: #6E6E6E;
    z-index: -1;
    transition: 1s;
    box-shadow: 0.4rem 0.6rem 0.6rem rgba(0, 0, 0, 0.2);
}

    form .suggestions li {
        margin: 18px 0;
        padding: 0;
        cursor: pointer;
    }

        form .suggestions li:hover {
            color: #741CAF;
        }

        form .suggestions li b {
            font-weight: 900;
        }

.clearfix::before,
.clearfix::after {
    content: " ";
    display: table;
    z-index: -1;
}

.clearfix::after {
    clear: both;
}
$(document).ready(function () {
    $(".circle").click(function () {
        $(this).toggleClass("expand");
        $(".form-control").toggleClass("show");
        $(".btn").toggleClass("hide");
        $('.handle').toggleClass("tidy");
    });
    $('.btn').click(function () {
        $('.suggestions').toggleClass("hide");
        $('.loading').toggleClass("hide");
    })
});

$('input').keyup(function () {
    var $suggestions = $('.suggestions');
    var text = $(this).val();
    if (text.length) {
        $suggestions.html('').addClass('active');
        $suggestions.append($('<li />', { html: '<b>' + text + '</b>' }));
        $suggestions.append($('<li />', { html: 'Veritatis et <b>' + text + '</b>' }));
        $suggestions.append($('<li />', { html: 'ut aliquid ex <b>' + text + '</b> vero eos' }));
    } else {
        $suggestions.html('').removeClass('active');
    }
});
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css'>
<link rel='stylesheet' href='http://frontendfreecode.com/codes/files/aos.css'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" crossorigin="anonymous">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css'>
<link rel='stylesheet' href='http://frontendfreecode.com/codes/files/aos.css'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" crossorigin="anonymous">

<style>
@import url("https://fonts.googleapis.com/css?family=Overlock");

body {
    background: #201c29 !important;
}

.frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    margin-top: -200px;
    margin-left: -200px;
    border-radius: 2px;
    background: #643a7a;
    box-shadow: 0.5rem 1rem 1rem rgba(0, 0, 0, 0.6);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    align-items: center;
}

form {
    display: flex;
}

.circle {
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    width: 4rem;
    height: 4rem;
    box-shadow: 0.4rem 0.6rem 0.6rem rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: 1s;
    align-items: center;
    justify-content: flex-start;
    background: #643a7a;
    overflow: hidden;
}

.expand {
    width: 15rem;
    border-radius: 0;
}

form {
    width: 15rem;
}

.form-control {
    border: none;
    outline: none !important;
    box-shadow: none !important;
    opacity: 0;
    background: transparent !important;
    font-family: "overlock";
    font-size: 1.2rem;
}

.show {
    opacity: 1;
    transition: 1s;
}

input {
    outline: none;
    border: none !important;
    color: white !important;
}

::-moz-placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* 
.start {
overflow: hidden; /* Hides letters as typing effect happens  
white-space: nowrap; /* Keeps the content on a single line 
margin: 0 auto; /* Gives that scrolling effect as the typing happens 
animation: typing 1.8s steps(40, end);
}
/* The typing effect 
@keyframes typing {
from {
width: 20%;
}
to {
width: 15rem;
}
}
*/
.btn {
    font-size: 125%;
    border-radius: 0;
    padding: 0.5rem;
    z-index: 1000;
    transition: 1s;
}

    .btn i {
        color: white;
    }

    .btn:focus {
        box-shadow: none !important;
    }

.hide {
    opacity: 0;
    z-index: -1;
}

.fa-spinner {
    position: absolute;
    left: 40%;
    top: 30%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 2000%;
    -webkit-animation: loading 3s ease-in-out infinite;
    animation: loading 3s ease-in-out infinite;
}

@-webkit-keyframes loading {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes loading {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.handle {
    position: absolute;
    top: 58%;
    left: 54%;
    background: white;
    box-shadow: 0.5rem 0.5rem 1rem rgba(0, 0, 0, 0.5);
    width: 2rem;
    height: 4px;
    border-radius: 2px;
    transform: rotate(45deg);
    z-index: 1;
    transition: 1s;
}

.tidy {
    transform: translateY(-2rem) rotate(0);
}

form .suggestions {
    border: none !important;
    position: absolute;
    top: 57%;
    left: 20%;
    width: 60%;
    background: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 20px;
    padding: 0 15px;
    margin: 0;
    list-style: none;
    color: #6E6E6E;
    z-index: -1;
    transition: 1s;
    box-shadow: 0.4rem 0.6rem 0.6rem rgba(0, 0, 0, 0.2);
}

    form .suggestions li {
        margin: 18px 0;
        padding: 0;
        cursor: pointer;
    }

        form .suggestions li:hover {
            color: #741CAF;
        }

        form .suggestions li b {
            font-weight: 900;
        }

.clearfix::before,
.clearfix::after {
    content: " ";
    display: table;
    z-index: -1;
}

.clearfix::after {
    clear: both;
}
</style>

</head>
<body>
<div class="frame">
        <!-- <div class="circle" data-aos="fade-up" data-aos-easing="ease-out-back"> -->
        <div class="circle">
                <form action="#">
                        <input class="form-control" type="search" name="show" placeholder="Start typing + click button" aria-label="Search" />
                        <div class="btn hide" type="submit" id="show"><i class="fas fa-search"></i></div>
                        <ul class="suggestions clearfix"></ul>
                </form>
        </div>
        <div class="handle"></div>
        <div class="loading hide">
                <i class="fas fa-spinner"></i>
        </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$(document).ready(function () {
    $(".circle").click(function () {
        $(this).toggleClass("expand");
        $(".form-control").toggleClass("show");
        $(".btn").toggleClass("hide");
        $('.handle').toggleClass("tidy");
    });
    $('.btn').click(function () {
        $('.suggestions').toggleClass("hide");
        $('.loading').toggleClass("hide");
    })
});

$('input').keyup(function () {
    var $suggestions = $('.suggestions');
    var text = $(this).val();
    if (text.length) {
        $suggestions.html('').addClass('active');
        $suggestions.append($('<li />', { html: '<b>' + text + '</b>' }));
        $suggestions.append($('<li />', { html: 'Veritatis et <b>' + text + '</b>' }));
        $suggestions.append($('<li />', { html: 'ut aliquid ex <b>' + text + '</b> vero eos' }));
    } else {
        $suggestions.html('').removeClass('active');
    }
});
</script>

</body>
<script>'undefined'=== typeof _trfq || (window._trfq = []);'undefined'=== typeof _trfd && (window._trfd=[]),_trfd.push({'tccl.baseHost':'secureserver.net'},{'ap':'cpbh-mt'},{'server':'p3plmcpnl484880'},{'dcenter':'p3'},{'cp_id':'765442'},{'cp_cl':'8'}) // Monitoring performance to make your website faster. If you want to opt-out, please contact web hosting support.</script><script src='https://img1.wsimg.com/traffic-assets/js/tccl.min.js'></script></html>
Preview