looking for some solutions? You are welcome.

SOLVED: Sibling button shrink and grow

Muyie:
input[type=text] {
  width: 130px;
  box-sizing: border-box;
  border: 2px solid #ccc;
  border-radius: 25px;
  font-size: 16px;
  background-color: white;
  padding: 5px 0px 5px 10px;
  -webkit-transition: width 0.4s ease-in-out;
  transition: width 0.4s ease-in-out;
  right: 10px;
  position: fixed;
}

input[type=text]:focus {
  width: 96%;
}

.navbar {
    background: #fff;
    border: none;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>

<nav class="navbar navbar-expand-lg navbar-light fixed-top" style="background-color:#6d7fcc;">
  <div class="container-fluid">
     <button type="button" id="sidebarCollapse" class="btn btn-info">
       <i class="fas fa-align-left"></i>
       <span>Table Of Contents</span>
     </button>
     <input type="text" name="search" placeholder="Search...">
  </div>
</nav>

Could someone help me please. How can I shrink the button with transition (right to left) until it disappear whenever input is on focus. And grow with transition (left to right) when focus is not on input. Thank you.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent