This plugin create with the right HTML a smart floating label 🎈
$("#basic input").floatingLabel();
$("#dark input").floatingLabel({
placeholderColor: "#8c8c8c"
});
$("#full-name").floatingLabel();
<div>
<label for="fullname">Full Name</label>
<input type="text" id="fullname">
</div>
Option | Type | Default | Possibilities |
---|---|---|---|
transition | boolean | true |
If you want the label to be animated |
transitionProperties | string | all |
The css properties you want to be animated. |
transitionDuration | string | .2s |
How long should be the transition. |
placeholderColor | string | The text color of the input |
The text color when the label plays like a placeholder. |
$("#full-name").floatingLabel({
transitionProperties: 'background',
transitionDuration: '.3s',
placeholderColor: 'pink'
});
The label has a class floating
and when it float the class is
is added.
âš You may need to add !important
to your rules.
.floating {
color: green!important;
&.is {
color: red!important;
border: 0.0625rem solid #dee2e6;
border-radius: .5rem;
padding: .2rem .5rem!important;
}
}