LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Just check it !

Login Form with Sign In button validation

It validates empty fields, logins & passwords shorter than 3 signs and also "Lost Your Password" link.

Made by Kamil Rybinski

Login Form

Close

CSS
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,700);
body {
  background-color: #39163b;
  margin: 0;
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: #fff;
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  height: 100vh;
}
.about .slogan {
  font-size: 30px;
  margin-bottom: 20px;
  text-align: center;
}
.about h1 {
  font-size: 14px;
  text-align: center;
  font-weight: 700;
}
.about .description {
  text-align: center;
  font-size: 13px;
  margin: 0;
}
.about .owner {
  margin-top: 15px;
  text-align: center;
  font-size: 10px;
}
.about .owner a {
  color: #3498db;
  text-decoration: none;
}
.form {
  width: 360px;
  height: 330px;
  background-color: #fff;
  border-radius: 4px;
  margin-top: 10vh;
}
.form .form-header {
  width: 100%;
  height: 70px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  position: relative;
  background: -webkit-linear-gradient(#78517B, #552E55);
  /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#78517B, #552E55);
  /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#78517B, #552E55);
  /* For Firefox 3.6 to 15 */
  background: linear-gradient(#78517B, #552E55);
  /* Standard syntax */
}
.form .form-header .name {
  font-size: 17px;
  font-weight: 300;
  float: left;
  margin-top: 25px;
  margin-left: 15px;
}
.form .form-header .close-icon {
  font-size: 20px;
  position: absolute;
  top: 25px;
  right: 15px;
}
.form .form-header .close-icon:hover {
  cursor: pointer;
}
.form .content {
  width: 100%;
  height: 150px;
}
.form .content input {
  display: flex;
  justify-content: center;
  margin-left: 20px;
  width: 298px;
  height: 50px;
  border-radius: 4px;
  border: 1px solid #b3b3b3;
  background-color: #ecf0f1;
  color: #2c3e50;
  outline: 0;
}
.form .content input:nth-child(1) {
  margin-top: 35px;
}
.form .content input:nth-child(2) {
  margin-top: 20px;
}
.form .content input[placeholder] {
  padding-left: 15px;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: #2c3e50;
  /* Set placeholders colors */
}
.form .content input[placeholder]::-webkit-input-placeholder {
  color: #2c3e50;
}
.form .content input[placeholder]:-moz-placeholder {
  color: #2c3e50;
}
.form .content input[placeholder]::-moz-placeholder {
  color: #2c3e50;
}
.form .content input[placeholder]:-ms-input-placeholder {
  color: #2c3e50;
}
.form .signin {
  width: 100%;
  height: 80px;
}
.form .signin .btnSignIn {
  width: 100px;
  height: 40px;
  border-radius: 4px;
  background-color: #734d76;
  margin-left: 20px;
  float: left;
  border: 1px solid #734d76;
  transition: all 0.5s ease-in-out;
}
.form .signin .btnSignIn:hover {
  cursor: pointer;
  background-color: #fff;
  color: #39163b;
  border-color: #734d76;
}
.form .signin .btnSignIn h1 {
  font-size: 13px;
  text-align: center;
  padding-top: 5px;
}
.form .signin .lost {
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
  float: left;
  padding-top: 14px;
  padding-left: 26px;
}
.form .signin .lost:hover {
  cursor: pointer;
}
.info {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: 400px;
  height: 180px;
  background-color: #FFF;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  box-shadow: 1px 1px 2px #000;
}
.info .infoHeader {
  width: 100%;
  height: 40px;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  background: -webkit-linear-gradient(#78517B, #552E55);
  /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#78517B, #552E55);
  /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#78517B, #552E55);
  /* For Firefox 3.6 to 15 */
  background: linear-gradient(#78517B, #552E55);
  /* Standard syntax */
}
.info .infoHeader h1 {
  font-family: Arial;
  font-size: 14px;
  font-weight: 600;
  color: #FFF;
  float: left;
  margin-top: 14px;
  margin-left: 20px;
  text-shadow: 0px 1px 1px #000;
}
.info .infoContent {
  width: 100%;
  height: 50px;
}
.info .infoContent p {
  font-family: Arial;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  margin-top: 30px;
  color: #4d4d4d;
}
.info .closeSection {
  width: 100%;
  height: 40px;
}
.info .closeSection .btnClose {
  width: 100px;
  height: 40px;
  border-radius: 3px;
  background-color: #734d76;
  margin: 0 auto;
}
.info .closeSection .btnClose:hover {
  cursor: pointer;
}
.info .closeSection .btnClose h1 {
  font-family: Arial;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: #FFF;
  padding-top: 12px;
  text-shadow: 0px 1px 1px #000;
}
JS
var btnSignIn = $('.btnSignIn');
var btnClose = $('.btnClose');
var btnLost = $('.lost');

btnSignIn.click(function() {
  var login = $('#username');
  var pass = $('#password');
  var info = $('.info');
  var infoH1 = $('.infoH1');
  var infoP = $('.infoP');
  
  // Sign In button
  // Data validation
  if (login.val() == '' || pass.val() == '') {
    //info.fadeIn(300).css('display', 'block');
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Validation Error');
    infoP.css('color', '#E53935');
    infoP.html('You have to fill both fields if you want to sign in.');
  } else if (login.val().length <= 3 || pass.val().length <= 3) {
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Too short Password');
    infoP.css('color', 'red');
    infoP.html('Your login or password is too short.');
  } else {
    info.fadeIn(300).css('display', 'block');
    infoH1.html('Successfull');
    infoP.css('color', 'green');
    infoP.html('You are logged successfully.');
  }
});

// Lost Your Password
btnLost.click(function() {
  var info = $('.info');
  var infoH1 = $('.infoH1');
  var infoP = $('.infoP');
  
  info.fadeIn(300).css('display', 'block');
  infoH1.html('You have lost your password ?');
  infoP.css('color', '#1565C0');
  infoP.html('It\'s not my falut :)');
});

// Close button
btnClose.click(function() {
  var info = $('.info');
  var con = $('#container');
  
  info.fadeOut(300).css({
      'display': 'block'     
  });
  
});
Host Instantly Drag and Drop Website Builder

 

Description

Login form which validates data
Term
Tue, 12/26/2017 - 09:47

Related Codes

Pen ID
Pen ID
Pen ID