I created this function which animates label when input has focus.
$("input").on("focus", function () {
$(this).siblings().animate({
top: "-20",
}, 70, function() {
});
});
I would like animate it back if input stays unfilled.
Here is my codepen
$("input").on("focus", function () {
$(this).siblings().animate({
top: "-20",
}, 70, function() {
});
});
$("input").on("blur", function() {
if( $(this).val().length == 0 ) {
$(this).siblings().animate( {
top : "0"
});
}
});
http://codepen.io/anon/pen/VavgLv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With