<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="card">
<div class="header">
<h2>Drop us a line...</h2>
<p>Drop us a message and we will contact you back shortly</p>
<svg version="1.1" id="Layer" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 113 120" xml:space="preserve" preserveAspectRatio="none">
<style type="text/css">
.st0{fill: #fff; stroke: rgba(0,0,0,0.2); stroke-width: 2px;}
</style>
<g>
<path class="st0" d="M93.8,87.4c16.7-28.2,23.9-51,11.5-70.9C100.1,8.2,92.4,4.3,84,2.7c6.1,12.9,6.3,28.3-0.4,41.7
c5,2.6,8.3,7.9,8.3,13.9c0,8.7-7,15.7-15.7,15.7c-4.3,0-8.2-1.7-11.1-4.6l-19,14.8c0.7,1.4,0.4,3.1-0.9,4.1l-4,3.1
c-1.4,1.1-3.5,0.8-4.5-0.6l-0.1-0.1c-1.1-1.4-0.8-3.5,0.6-4.5l4-3.1c1.3-1,3-0.9,4.2,0.2l18.9-14.8c-2.4-2.8-3.8-6.4-3.8-10.3
c0-8.7,7-15.7,15.7-15.7c0.5,0,1,0,1.5,0.1c6.9-13.1,6.2-28.5-1-40.7c-10-0.5-20.3,1.2-28.4,2.2C31,6.2,26.8,1,26.8,1
c-3.8,11.5,5.9,17,5.9,17s1.7-0.8-2.4,4.2c-4.1,5.1-5.2,15.6-5.8,18.4c-0.6,2.8,1.6,2.7,2.3,5.8c0.7,3.1-9.2,16.4-10.2,19.7
c-1,3.3,8.1,6.9,8.1,6.9l-1.4,4.5c0.7,2.5,13.9,2,13.9,2c-2.8,4.2-10.5,3.7-10.5,3.7l-2.3,1.6c0,0,1.3,1.7,2.4,2.7
c1.1,1,1.1,6.2,1.1,6.2c-1.3,8.6,1,10.3,5.9,12.5s12.6-3.1,12.6-2.1c0,1-0.1,19.8-0.1,19.8c29.7,14.6,51.4-6.4,51.4-6.4
C95,109.8,93.8,87.4,93.8,87.4z"/>
</g>
</svg>
</div>
<form class="form-wrap" id="md-form" autocomplete="off" method="get">
<div class="input-wrap">
<i class="material-icons">person</i>
<label for="a">Name</label>
<input class="input" type="text" id="a" placeholder="First and Last name" value="" />
</div>
<div class="input-wrap">
<i class="material-icons">email</i>
<label for="b">E-mail</label>
<input class="input" type="email" id="b" placeholder="email@mail.com" value="" />
</div>
<div class="input-wrap">
<i class="material-icons">mic</i>
<label for="c">Message</label>
<textarea class="input" id="c" placeholder="Write what you feel" /></textarea>
</div>
<div class="input-wrap">
<input type="checkbox" id="d">
<label for="d">You agree on our terms and conditions</label>
</div>
<div class="input-wrap">
<button id="confirm" type="submit">Submit</button>
</div>
</form>
<div class="ending">
<div>
<i class="material-icons">check</i>
</div>
<div>
<h2>Your Message has been sent successfuly</h2>
</div>
</div>
<!-- end of ending -->
</div>
<!-- end of Card -->
<script>
$('.input').on("focus blur", function() {
if ($(this).val().length > 0 || $('.input').is(':focus')) {
$(this).siblings().addClass('active');
$(this).parent().addClass('active');
} else {
$(this).siblings().removeClass('active').addClass('not');
$(this).parent().removeClass('active').addClass('not');
}
if ($(this).val().length < 2 && $('.input').is(':focus') != true && $(this).is(':invalid') || $(this).is(':invalid') && $('.input').is(':focus') != true) {
$(this).parent().addClass('invalid');
$(this).siblings().addClass('invalid');
} else {
$(this).parent().removeClass('invalid');
$(this).siblings().removeClass('invalid');
}
if ($(this).val().length > 0 && $(this).is(':valid') && $('.input').is(':focus') != true) {
$(this).parent().addClass('valid');
$(this).siblings().addClass('valid');
} else {
$(this).parent().removeClass('valid');
$(this).siblings().removeClass('valid');
}
});
$('#d').change(enableBtn);
$('.input').blur(enableBtn);
function enableBtn() {
if ($('#d').is(':checked') == false || $('.input').parent('.input-wrap').hasClass('invalid') == true || $('.input').val().length < 2) {
$("#confirm").prop("disabled", true);
} else {
$("#confirm").prop("disabled", false);
}
}
enableBtn();
$('#confirm').click(function() {
$('form').submit(function(event) {
$('.card').addClass('end');
$('.ending').addClass('showed');
event.preventDefault();
});
});
</script>
::-webkit-input-placeholder {
text-align: right;
font-style: italic;
color: #ff4081;
font-size: 13px;
}
::-moz-placeholder {
text-align: right;
font-style: italic;
color: #ff4081;
font-size: 13px;
}
body {
margin: 0;
font-size: 16px;
font-family: 'Roboto', sans-serif;
color: #454545;
background: #374046;
}
svg {
width: 110px;
height: 120px;
float: right;
margin-top: -55px;
}
h1,
h2,
h3 {
margin: 0;
}
button::-moz-focus-inner {
border: 0;
}
button {
background: #ff4081;
border: none;
border-radius: 2px;
color: #fff;
height: 36px;
padding: 0px 15px;
font-size: 14px;
font-weight: 500;
text-transform: uppercase;
text-align: center;
line-height: 36px;
vertical-align: middle;
font-family: 'Roboto', sans-serif;
}
button i {
color: #fff;
}
button[disabled] {
background: #ddd;
color: #757575;
}
i.material-icons {
font-size: 18px;
}
.input:focus {
outline-width: 0px;
}
.input:invalid {
box-shadow: none;
}
.card {
border-radius: 4px;
margin: 20px auto;
padding: 0 0 20px;
background: #fff;
box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
width: 360px;
overflow: hidden;
}
.card.end {
padding-bottom: 0;
}
.card.end form {
display: none;
}
.header {
height: 150px;
background-image: linear-gradient(180deg, #FF7D78, #673AB7);
background-size: 100% 100%;
margin-bottom: px;
color: #fff;
padding: 10px 15px;
overflow: hidden;
}
.header h2 {
font-size: 28px;
font-weight: 300;
}
.header p {
padding-right: 80px;
}
/* Form styling */
form {
padding: 0 15px;
}
.input {
border-width: 0 0 1px 0;
border-color: #ccc;
border-style: solid;
width: 100%;
padding: 10px 5px 10px 0;
font-family: 'Roboto', sans-serif;
font-size: 14px;
}
.input-wrap {
position: relative;
margin: 20px auto 0;
}
.input-wrap:first-child {
margin-top: 0;
}
label {
top: 25px;
position: absolute;
left: 35px;
transition: all 0.8s ease-in-out;
color: #ccc;
}
i {
position: relative;
left: 0px;
top: 25px;
transition: all 0.8s ease-in-out;
color: #757575;
}
button i {
top: 0;
margin-right: 15px;
}
i.active {
top: 10px;
width: 100%;
height: 100%;
color: #673AB7;
transition: all 0.8s;
}
label.active {
top: 10px;
transition: all 0.8s;
color: #FF4081;
}
i.invalid,
label.active.invalid {
color: #F44336;
}
.active textarea,
.not textarea {
border-bottom: none;
}
.input-wrap:before {
content: ' ';
position: absolute;
font-size: 16px;
right: 0;
width: 20px;
height: 20px;
-webkit-padding-before: 4px;
-webkit-padding-end: 3px;
-webkit-padding-after: 2px;
-webkit-padding-start: 4px;
text-align: center;
top: 20px;
background-color: transparent;
border-radius: 50%;
color: #fff;
font-family: "Material Icons";
transform: scale(0) rotate(90deg);
transform-origin: center;
transition: all 0.4s;
}
.input-wrap.valid:before {
content: '\e5ca';
background-color: #4CAF50;
transform: scale(1) rotate(0deg);
transition: all 0.8s;
}
.input-wrap.invalid:before {
content: '\e14c';
background-color: #F44336;
transform: scale(1) rotate(0deg);
transition: all 0.8s;
}
.input-wrap.active:after,
.input-wrap.not.active:after {
border-bottom: 2px solid #FF4081;
bottom: 0;
left: 0;
content: "";
height: 0;
position: absolute;
width: 101%;
animation-name: bord;
animation-fill-mode: forwards;
animation-duration: 0.8s;
animation-timing-function: ease;
}
.input-wrap.not:after {
border-bottom: 2px solid #ff4081;
bottom: 0;
left: 0;
content: "";
height: 0;
position: absolute;
width: 100%;
animation-name: bords;
animation-fill-mode: forwards;
animation-duration: 0.8s;
animation-timing-function: ease;
}
.input-wrap.active.invalid:after {
border-bottom: 2px solid #F44336;
bottom: 0;
left: 0;
content: "";
height: 0;
position: absolute;
width: 100%;
animation-name: bord;
animation-fill-mode: forwards;
animation-duration: 0.8s;
animation-timing-function: ease;
}
input[type="checkbox"] {
text-indent: -9999px;
vertical-align: text-top;
}
[type="checkbox"] + label:before,
[type="checkbox"] + label:after {
content: '';
left: 0;
position: absolute;
z-index: 1;
}
[type="checkbox"]:not(:checked) + label:before {
width: 0;
height: 0;
border: 3px solid transparent;
left: 3px;
top: 0px;
transform: scale(0);
transform-origin: 100% 100%;
transition: all 0.8s;
}
[type="checkbox"]:not(:checked) + label:after {
height: 12px;
width: 12px;
background-color: #fff;
border: 1px solid #aaa;
top: 3px;
left: 4px;
transition: all 0.8s;
z-index: 0;
}
[type="checkbox"]:checked + label:before {
content: '\e876';
top: 0px;
left: 3px;
font-size: 16px;
color: #fff;
font-family: "Material Icons";
transform: scale(1);
transition: all 0.8s;
}
[type="checkbox"]:checked + label:after {
top: 3px;
left: 4px;
width: 12px;
height: 12px;
border: 1px solid #ff4081;
background-color: #ff4081;
transition: all 0.8s;
z-index: 0;
}
input[type="checkbox"] + label {
position: static;
font-size: 12px;
color: #757575;
font-weight: 500;
}
/* End styles */
.card .ending {
visibility: hidden;
display: flex;
height: 0;
transition: visibility 0.8s linear;
}
.card.end .ending {
height: 100%;
min-height: 64px;
visibility: visible;
transition: visibility 0.8s linear;
}
.ending div:first-child {
width: 0;
}
.end .ending div:first-child {
background: #673AB7;
width: 85px;
transition: all 0.8s linear;
}
.ending h2 {
font-size: 20px;
text-align: center;
font-weight: 300;
padding-top: 10px;
}
.ending i {
transform: scale(0) rotate(360deg);
left: 5px;
transition: all 0.8s ease;
}
.ending.showed i {
color: #fff;
font-size: 60px;
top: 0;
transform: scale(1) rotate(0deg);
transition: all 0.8s ease;
}
@keyframes bord {
0% {
width: 0%;
}
100% {
width: 101%;
}
}
@keyframes bords {
0% {
width: 100%;
}
100% {
width: 0%;
}
}
@keyframes opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}