LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code




  
  

  
  Login/Sign-Up Form - By MuhammadJ



  

Sign In
CSS
body {
  margin: 0;
  
}

html {
  width: 100%;
  padding:20px;
  background: linear-gradient(to left, #ddd6f3, #faaca8);
  display: flex;
  justify-content: center;
  align-items: center;
  
}

*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-family: 'Space Mono', monospace;
}

::selection {
  background: #FDED62;
  color: #3C2FA4;
}

#wrapper {
  position: relative;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  background: #3C2FA4;
  width: 400px;
  height: 500px;
  overflow: hidden;
}

#one {
  position: absolute;
  width: 400px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px;
  opacity: 1;
  transition: all 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

#two {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px;
  transform: translateX(-100%);
  transition: all 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

input {
  font-family: 'Space Mono', monospace;
  font-size: 1em;
  font-weight: 700;
  outline: 0;
  padding-left: 10px;
  width: 100%;
  height: 30px;
  color: #FDED62;
  background: #3C2FA4;
  border: 1px solid #fff;
  transition: all 0.3s ease, transform 0.15s ease;
}

input:focus {
  border-color: #FDED62;
  background: #FDED62;
  color: #4133B4;
}

label {
  width: 100%;
  font-family: 'Karla', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  color: #fff;
  font-size: 13px;
  transition: all 0.2s ease
}

input:hover,
label:hover {
  cursor: pointer;
}

p {
  position: relative;
  margin: 0 0 10px 0;
  padding: 0;
  z-index: 1;
}

p:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: #fb6868;
  transform: translate(5px, 5px);
  transition: all 0.33s ease;
}

p:not(.submit):hover::before {
  background: #fff;
}

::-webkit-input-placeholder {
  font-size: 0.8em;
  color: #3C2FA4;
  opacity: 0.5;
}

input[type="submit"] {
  color: #3C2FA4;
  border: none;
  background: #fff;
  font-style: italic;
  font-weight: 400;
  transition: all 0.33s ease;
}

input[type="submit"]:hover {}

p.submit {
  margin-top: 25px;
  transform: translateX(0);
  transition: all 0.2s ease;
}

.submit:after {
  content: "\0279C";
  color: #FCFBF9;
  top: 0;
  left: 100%;
  position: absolute;
  width: 30px;
  height: 100%;
  z-index: -2;
  font-family: 'Space Mono', monospace;
  font-size: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateX(0px);
  background: #fb6868;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.submit:before {
  position: absolute;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  content: '';
  background: transparent;
}

.submit:hover::after {
  transform: translateX(0px);
}

.submit:hover,
.submit::after {
  transform: translateX(-30px);
}

#button {
  position: absolute;
  transform: translateY(460px);
  width: 100%;
  height: 40px;
  color: #3C2FA4;
  font-style: italic;
  font-size: 0.8em;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#button:hover {
  cursor: pointer;
}

#button:before {
  content: "";
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  background: #fb6868;
  z-index: -1;
  transform: translateX(-100%) translateY(calc(2px - 100%));
  opacity: 0;
}

#button:hover::before {
  transition: transform .7s cubic-bezier(.19, 1, .22, 1);
  transform: translateX(0%) translateY(calc(2px - 100%));
  opacity: 1;
}

#button:after {
  content: "";
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  background: #fb6868;
  z-index: -2;
  transition: transform .8s cubic-bezier(.19, 1, .22, 1);
  transform: translateX(100%) translateY(calc(2px - 100%));
  opacity: 1;
}

#button:hover::after {
  transition: none;
  transform: translateX(0%) translateY(calc(2px - 100%));
  opacity: 0;
}
JS
/*global console, alert, confirm, prompt*/
var forms = document.forms;
p = document.querySelectorAll('p'),
  input = document.querySelectorAll('input:not([type="submit"])'),
  submit = document.querySelectorAll('input[type="submit"]');
password = input[2],
  password2 = document.getElementById('passwordIn'),
  email = input[1],
  email2 = document.getElementById('emailIn');

[].forEach.call(input, function(inputE) {
  'use strict';

  inputE.addEventListener('focus', function() {
    'use strict';
    inputE.parentNode.previousElementSibling.style.color = '#FDED62';
    inputE.style.transform = 'translate(5px, 5px)';
  });

  inputE.addEventListener('blur', function() {
    'use strict';
    console.log('blur');
    inputE.parentNode.previousElementSibling.style.color = '#fff';
    inputE.style.transform = 'translate(0px, 0px)';
  });
  /*
  inputE.addEventListener('mouseout', function () {
      'use strict';
      console.log('out');
      inputE.style.transform = 'translate(0px, 0px)';
  });

  inputE.addEventListener('mouseover', function () {
      'use strict';
      inputE.style.transform = 'translate(5px, 5px)';
  });
  */
});

function checkPassword(e) {
  'use strict';
  var el = e.target;
  console.log(el);
  if (el.value.length < 8 && el.value.length !== 0) {
    el.parentNode.previousElementSibling.style.color = '#FB6868';
  } else {
    el.parentNode.previousElementSibling.style.color = '#FDED62';
  }
}

function checkEmail(e) {
  'use strict';
  var el = e.target;
  var reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

  if (!reg.test(el.value) && el.value !== '') {
    el.parentNode.previousElementSibling.style.color = '#FB6868';
  } else {
    el.parentNode.previousElementSibling.style.color = '#FDED62';
  }
}

password.addEventListener('input', checkPassword);
password.addEventListener('focus', checkPassword);
email.addEventListener('input', checkEmail);
email.addEventListener('focus', checkEmail);
submit[0].addEventListener('click', function(e) {
  'use strict';
  e.preventDefault();
});

password2.addEventListener('input', checkPassword);
password2.addEventListener('focus', checkPassword);
email2.addEventListener('input', checkEmail);
email2.addEventListener('focus', checkEmail);
submit[1].addEventListener('click', function(e) {
  'use strict';
  e.preventDefault();
});

var button = document.getElementById('button'),
  wrapper = document.getElementById('wrapper'),
  c = true,
  one = document.getElementById('one'),
  two = document.getElementById('two');

button.addEventListener('click', function() {
  'use strict';
  if (c) {
    one.style.pointerEvents = 'none';
    two.style.pointerEvents = 'auto';
    one.style.opacity = '0.1';
    two.style.opacity = '1';
    one.style.transform = 'translateX(100%)';
    two.style.transform = 'translateX(0%)';
    button.textContent = 'Sign Up';

    c = false;
  } else {
    one.style.pointerEvents = 'auto';
    two.style.pointerEvents = 'none';
    one.style.opacity = '1';
    two.style.opacity = '0.1';
    one.style.transform = 'translateX(0%)';
    two.style.transform = 'translateX(-100%)';
    button.textContent = 'Sign In';

    c = true;
  }

});
Host Instantly Drag and Drop Website Builder

 

Description

Login/SignUp Form, CSS3, HTML5 & JS Validation.
Term
Wed, 11/29/2017 - 11:26

Related Codes

Pen ID
Pen ID
Pen ID