GeckoGrafix
1/8/2018 - 7:53 AM

Expandable search Bar

.menu-item.search {
    margin-left: 30px;
}

.nav-primary .genesis-nav-menu {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;

    align-items: center;
    -webkit-box-align: center;
    -webkit-box-pack: center;
    -ms-flex-align: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.search .search-form {
    text-align: center;
}

.search .search-form input[type="search"] {
    position: relative;
    width: 1px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    font-family: "Open Sans", sans-serif;
    font-size: 13px;
    cursor: pointer;
    -webkit-transition: width 500ms ease, background 400ms ease;
    transition: width 500ms ease, background 400ms ease;
}

.search .search-form input[type="search"]:focus {
    width: 250px;
    outline: 0;
    background-color: #fff;
    cursor: text;
}

.genesis-nav-menu .search input[type="submit"] {
    clip: rect(0, 0, 0, 0);
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
}

.search .search-form:before {
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

.home .search .search-form:before {
    color: #fff;
}

.site-container.white .search .search-form:before {
    color: #999;
}

@media only screen and (max-width: 862px) {
    .nav-primary .genesis-nav-menu {
        display: block;
    }
}

@media only screen and (max-width: 800px) {
    .menu-item.search {
        margin-bottom: 10px;
        margin-left: 20px;
    }

    .search .search-form:before {
        position: absolute;
        top: 10px;
        left: 0;
        color: #999;
        -webkit-transform: none;
        transform: none;
    }

    .search .search-form {
        text-align: left;
    }

    .search .search-form input[type="search"] {
        padding-right: 0;
        padding-left: 0;
    }
}
add_filter( 'wp_nav_menu_items','custom_nav_search' );
/**
* Add search box to nav menu.
*/
function custom_nav_search( $items ) {
    $items .= '<li class="menu-item search">' . get_search_form( false ) . '</li>';

    return $items;
}