JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<div class="login">
<div class="login__gradient"></div>
<h1 class="login__title">
coolCompany
</h1>
<div class="login__container">
<form class="login__form" action="#" type="post">
<div class="bounce bouce--pre"></div>
<div class="message login__message"></div>
<div class="login__fieldset login__fieldset--center">
<div class="login__info">
One click login via:
</div>
<button class="login__social" type="submit">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="10.3 134 574.8 574.3" class="icon icon--medium">
<title>Facebook</title>
<path fill="#3C5A99" d="M553.1 708.3c17.8 0 31.9-14.3 31.9-31.7v-511c0-17.4-14.3-31.7-31.7-31.7h-511c-17.8-.4-32.1 13.8-32.1 31.2v511.2c0 17.8 14.3 31.9 31.7 31.9h511.2z"/>
<path fill="#FFF" d="M406.8 708.3V485.7h74.9l11.2-87h-86.1v-54.6c0-25.2 6.7-42.4 43-42.4h45.9v-78.1c-8-.9-35.2-3.3-66.9-3.3-66.2 0-111.5 40.1-111.5 114.6v63.6h-74.9v87h74.7v222.4h89.7v.4z"/>
</svg>
</button>
<button class="login__social" type="submit">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" class="icon icon--medium">
<title>Twitter</title>
<path d="M0 0h400v400H0z" fill="#1da1f2"/>
<g id="Logo_FIXED" data-name="Logo — FIXED">
<path fill="#fff" d="M153.6 301.6c94.4 0 146-78.2 146-146 0-2.2 0-4.4-.2-6.6a104.4 104.4 0 0 0 25.6-26.5 102.4 102.4 0 0 1-29.5 8 51.5 51.5 0 0 0 22.6-28.3 102.8 102.8 0 0 1-32.4 12.4 51.3 51.3 0 0 0-87.4 46.8 145.6 145.6 0 0 1-105.6-53.6 51.3 51.3 0 0 0 16 68.5A51 51 0 0 1 85 170v.5a51.3 51.3 0 0 0 41 50.3 51.2 51.2 0 0 1-23 1 51.4 51.4 0 0 0 48 35.5 103 103 0 0 1-63.8 22 104.4 104.4 0 0 1-12.2-.8 145.2 145.2 0 0 0 78.6 23" class="cls-2"/>
<path d="M0 0h400v400H0z" fill="none"/>
</g>
</svg>
</button>
<button class="login__social" type="submit">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="37 159 518.7 518.7" class="icon icon--medium icon--google">
<title>Google</title>
<path fill="#4285F4" d="M408.9 423.5v-23.3H297.6v44h62.1c-2.6 15.5-10.4 25.9-23.3 36.2v28.5h38.8c22.1-19.4 33.7-51.7 33.7-85.4z"/>
<path fill="#34A853" d="M297.6 537.4c31.1 0 58.2-10.4 77.6-28.5l-38.8-28.5c-10.4 6.5-23.3 10.4-38.8 10.4-29.8 0-55.6-20.7-64.7-47.9h-38.8v29.8c18.1 38.8 58.2 64.7 103.5 64.7z"/>
<path fill="#FBBC05" d="M232.9 442.9c-2.6-6.5-3.9-12.9-3.9-22 0-7.8 0-15.5 3.9-22v-29.8h-38.8c-9.1 15.5-12.9 32.4-12.9 51.8s3.9 36.2 12.9 51.8l38.8-29.8z"/>
<path fill="#EA4335" d="M297.6 348.5c16.8 0 32.4 7.7 44 19.4l33.6-38.8c-19.4-12.9-46.6-25.9-77.6-25.9-45.3 0-85.4 25.9-103.5 64.7l38.8 28.5c9.1-25.9 35-47.9 64.7-47.9z"/>
<path fill="none" d="M181.2 304.5h232.9v232.9H181.2V304.5z"/>
</svg>
</button>
</div>
<div class="login__fieldset">
<div class="login__info">
Or use your email:
</div>
</div>
<div class="login__fieldset">
<label class="login__label" for="email">Email Address
<div class="input__message" id="emailmessage"></div></label>
<input class="login__input" name="email" type="email" id="email">
<label class="login__label" for="password">Password <span class="input__extrainfo">- minimum 8 digits</span>
<div class="input__message" id="passwordmessage"></div></label>
<input class="login__input" name="password" type="password" id="password">
<input class="login__button js-submit" value="LOGIN" type="submit">
<div class="login__footnote">
<a href="#" class="link">Forgot Password?</a> | <a href="#" class="link js-register">Register?</a>
</div>
</div>
<div class="statusbar"></div>
</form>
</div>
</div>
@import url('https://fonts.googleapis.com/css?family=Droid+Serif:400,400i,700,700i');
@import url('https://fonts.googleapis.com/css?family=Lato');
button {
border: 0;
margin: 0;
padding: 0;
background-color: transparent;
}
html, body, .login {
font-family: 'Lato', sans-serif;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-size: 15px;
}
.link {
color: #1a2980;
text-decoration: underline;
cursor: pointer;
}
.link:hover,
.link:focus {
color: blue;
}
.link--alt {
color: #fff;
}
.link--alt:hover,
.link--alt:focus {
color: #ddf;
}
.login__gradient {
position: fixed;
width: 100%;
height: 100%;
background: #bfd255;
background: linear-gradient(135deg, #fa354c 0%, #1a2980 100%);
z-index: -1;
}
.login__container {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.login__form {
overflow: hidden;
position: relative;
background: #fff;
padding: 55px 40px 10px;
box-shadow: 0 0 40px rgba(0, 0, 0, 0.3),
5px 5px 0 rgba(0, 0, 0, 0.1);
}
.login__form--alert {
animation: shake 150ms linear 3;
}
.message {
max-height: 0;
line-height: 1.5;
letter-spacing: 0.1px;
overflow: hidden;
transition: max-height 250ms linear;
}
.message--alert {
max-height: 300px;
background: #fa354c;
color: white;
animation: blink 250ms linear 2;
}
.message__link {
text-decoration: underline;
cursor: pointer;
}
.login__message {
padding: 10px;
margin: -55px 0 20px -40px;
width: calc(100% + 80px);
box-sizing: border-box;
}
.login__title {
font-family: 'Droid Serif', serif;
font-style: italic;
padding: 15px;
position: absolute;
margin-top: 0;
margin-bottom: 20px;
color: white;
}
.login__fieldset {
margin-bottom: 30px;
}
.login__fieldset--center {
text-align: center;
}
.login__info {
text-align: center;
margin-bottom: 10px;
color: grey;
}
.login__social {
cursor: pointer;
}
.icon {
padding: 5px;
}
.icon--medium {
width: 45px;
}
.icon--google {
outline: 1px solid lightgrey;
outline-offset: -5px;
}
.login__input {
display: block;
font-family: 'Lato', sans-serif;
font-size: 1rem;
padding: 10px;
margin-bottom: 30px;
width: 100%;
box-sizing: border-box;
transition: border 250ms ease-in-out;
}
.login__input--error {
border: 1px solid #fa354c;
}
.input__extrainfo {
color: grey;
font-size: 0.8rem;
}
.input__message {
font-size: 0.8rem;
}
.input__message--error {
color: #fa354c;
}
.login__label {
font-family: 'Lato', sans-serif;
font-size: 1rem;
position: relative;
display: block;
margin-top: -1rem;
transition: transform 200ms ease-in-out, opacity 200ms ease-in-out;
}
.login__button {
font-family: 'Lato', sans-serif;
border: transparent;
margin-top: -5px;
font-size: 1rem;
background: #1a2980;
color: white;
padding: 15px;
width: 100%;
cursor: pointer;
margin-bottom: 25px;
}
.login__footnote {
text-align: center;
}
.statusbar {
width: 100%;
height: 5px;
box-sizing: border-box;
position: absolute;
max-height: 0;
overflow: hidden;
left: 0;
bottom: 0;
transition: max-height 250ms linear;
}
.statusbar--loading {
max-height: 5px;
background: linear-gradient(to right, #4cd964, #007aff, #ff2d55, #5856d6, #4cd964);
background-size: 300% 100%;
animation: loading 2s linear infinite;
}
.statusbar--alert {
max-height: 5px;
background: #fa354c;
animation: blink 250ms linear 2;
}
@keyframes loading {
0%{background-position: 0% 100%}
100%{background-position: 300% 100%}
}
@keyframes blink {
50%{background: transparent}
}
@keyframes shake {
25%{transform: translateX(-5%)}
50%{transform: translateX(5%)}
}
.bounce {
top: 50%;
left: 50%;
width: 10px;
height: 10px;
position: absolute;
background-color: #1a2980;
border-radius: 50%;
z-index: 1000;
transform: translate(-50%, -50%) scale(1, 1);
animation: bounce 850ms linear 1 forwards;
}
.bouce--pre {
pointer-events: none;
width: 100%;
height: 100%;
border-radius: 0;
background-color: #fff;
animation: fade 250ms linear 1 forwards;
}
@keyframes bounce {
100%{
background-color: #fff;
transform: translate(-50%, -50%) scale(500, 500);
}
}
@keyframes fade {
100%{
opacity: 0;
}
}
const form = document.querySelector('.login__form');
const loginButton = document.querySelector('.js-submit');
const statusbar = document.querySelector('.statusbar');
const message = document.querySelector('.message');
const emailInput = document.querySelector('#email');
const passwordInput = document.querySelector('#password');
const emailMessage = document.querySelector('#emailmessage');
const passwordMessage = document.querySelector('#passwordmessage');
const registerButton = document.querySelector('.js-register');
const preBounce = document.querySelector('.bouce--pre');
preBounce.addEventListener('animationend', function(e) { e.target.style.display = 'none' })
loginButton.addEventListener('click', loginHandler);
function loginHandler(e) {
e.preventDefault();
statusbarClassHandler('loading');
setTimeout(() => errorHandler(), 2000);
}
function errorHandler() {
statusbarClassHandler('alert');
form.addEventListener('animationend', writeMessageError);
form.classList.add('login__form--alert');
function writeMessageError() {
form.removeEventListener('animationend', writeMessageError);
message.innerHTML = `
<ul><li>
<label for="email" class="link link--alt">Wrong email</label> or <label for="password" class="link link--alt">password</label>
</li>
<li>Don’t have an account yet? <a href="#" class="link link--alt">Register here</a></ul>`;
messageClassHandler('alert');
emailMessage.innerHTML = `Please check your email address`;
passwordMessage.innerHTML = `Please check your password`;
emailMessage.classList.add('input__message--error');
passwordMessage.classList.add('input__message--error');
emailInput.classList.add('login__input--error');
passwordInput.classList.add('login__input--error');
}
}
function statusbarClassHandler(name) {
statusbar.classList.remove('statusbar--loading');
statusbar.classList.remove('statusbar--alter');
statusbar.classList.add(`statusbar--${name}`);
}
function messageClassHandler(name) {
message.classList.remove('message--alert');
message.classList.add(`message--${name}`);
}
registerButton.addEventListener('click', openHandler);
function openHandler(e) {
e.preventDefault();
const el = e.target;
const bounce = document.createElement('div');
el.style.position = 'relative';
el.appendChild(bounce);
bounce.classList.add('bounce');
bounce.addEventListener('animationend', function() {
location.reload(true);
});
}
Also see: Tab Triggers