gilroyhacks.com/js/contact.js

39 lines
926 B
JavaScript
Raw Permalink Normal View History

2022-07-18 01:40:50 -07:00
// Src: https://codepen.io/nikhil8krishnan/pen/gaybLK
//material contact form animation
$(".contact-form")
.find(".form-control")
.each(function () {
var targetItem = $(this).parent();
if ($(this).val()) {
$(targetItem).find("label").css({
top: "10px",
fontSize: "14px"
});
}
});
$(".contact-form")
.find(".form-control")
.focus(function () {
$(this).parent(".input-block").addClass("focus");
$(this).parent().find("label").animate(
{
top: "10px",
fontSize: "14px"
},
300
);
});
$(".contact-form")
.find(".form-control")
.blur(function () {
if ($(this).val().length == 0) {
$(this).parent(".input-block").removeClass("focus");
$(this).parent().find("label").animate(
{
top: "25px",
fontSize: "18px"
},
300
);
}
2022-07-06 15:51:50 -07:00
});