$('#toggle').on('click blur', function() {
$('.morphsearchinput').toggleClass('expanded');
});
.morphsearchinput {
-webkit-transition: width .8s , height .8s ease, -webkit-transform 2s;
-moz-transition: width .8s, height .8s ease, -moz-transform 2s;
-ms-transition: width .8s, height .8s ease;
-o-transition: width .8s, height .8s ease;
transition: width .8s, height .8s ease, transform 2s;
transform: translate(200px,100px); \t
min-width: 50px;
min-height: 40px;
width: 0%;
height: 0%;
-webkit-animation-name: example;
-webkit-animation-duration: 2s;
animation-name: example;
animation-duration: 2s;
}
@-webkit-keyframes example {
from {translate(0px,0px);}
to {translate(200px,100px);}
}
@keyframes example {
from {translate(0px,0px);}
to {translate(200px,100px);}
}
.expanded {
width: 80% !important; /* !important because min-width is stronger than width */
}
body {
background-color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form class="morphsearch-form">
<input class="morphsearchinput" type="search" placeholder="Search..." id="toggle" />
</form>
Я хочу изменить положение панели поиска, когда расширяется. Я хочу немного перевести его, но каким-то образом мой код для панели поиска не работает. Я также добавил анимацию для плавного перевода x и y, но она также не работает.
уже сделал .please посмотрите –