cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!--
	Exercise from Briefbox.me
	Brief: Design a simple, fresh sign-up form

	Disclaimer:
	Background taken from https://sumry.me/login | Credits to them. I just didn't wanted to bother to create something like this
-->

<form method="post" autocomplete="off">
	<p class="intro1">First try to log with anything to see a <strong style="color: #ff3322">failed</strong> login&hellip;</p>
	<p class="intro2">Now try to log with "john@doe.com" and "test" to see a <strong style="color: #a4c639">successful</strong> login!</p>

	<div class="row">
		<div class="wrapper large-4 columns large-centered small-6 small-centered">
			<div class="row header">
				<div class="large-12 columns">SIGN IN</div>
			</div>

			<div class="row username">
				<div class="large-9 columns large-centered">
					<label for="username"><i class="fa fa-user"></i></label>
					<input id="username" type="email" name="username" placeholder="john@doe.com" required autocomplete="off" />
				</div>
			</div>

			<div class="row password">
				<div class="large-9 columns large-centered">
					<label for="password"><i class="fa fa-lock"></i></label>
					<input id="password" type="password" name="pass" placeholder="password" required autocomplete="off" />
				</div>
			</div>

			<div class="row submit">
				<div class="large-9 columns large-centered">
					<input type="submit" value="SUBMIT">
				</div>
			</div>
		</div>
	</div>
</form>

<span class='morphButton'>
	<img class="avatar" src="http://www.migloo.be/labs/lab1/img/avatar.png" alt="John... Doe?">
	<i class="fa fa-refresh fa-spin loading"></i>
	<i class="fa fa-check success"></i>
	<i class="fa fa-times failure"></i>
</span>

<span class="morphHeader"><span>SIGN IN</span></span>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Montserrat);
@import url(https://fonts.googleapis.com/css?family=Open+Sans);

@mixin border-radius($topleft, $topright, $bottomleft, $bottomright) {
	-webkit-border-top-left-radius: $topleft;
	-moz-border-top-left-radius: $topleft;
	-ms-border-top-left-radius: $topleft;
	border-top-left-radius: $topleft;

	-webkit-border-top-right-radius: $topright;
	-moz-border-top-right-radius: $topright;
	-ms-border-top-right-radius: $topright;
	border-top-right-radius: $topright;

	-webkit-border-bottom-left-radius: $bottomleft;
	-moz-border-bottom-left-radius: $bottomleft;
	-ms-border-bottom-left-radius: $bottomleft;
	border-bottom-left-radius: $bottomleft;

	-webkit-border-bottom-right-radius: $bottomright;
	-moz-border-bottom-right-radius: $bottomright;
	-ms-border-bottom-right-radius: $bottomright;
	border-bottom-right-radius: $bottomright;
}

@mixin box-shadow($color) {
	-webkit-box-shadow: 0 0 20px 5px $color;
	box-shadow: 0 0 20px 5px $color;
}

@mixin transition($duration) {
	-webkit-transition: all $duration ease-in-out;
	-moz-transition: all $duration ease-in-out;
	-ms-transition: all $duration ease-in-out;
	-o-transition: all $duration ease-in-out;
	transition: all $duration ease-in-out;
}

$body: 'Montserrat', Helvetica, Arial, sans-serif;
$heading: 'Arvo', sans-serif;
$firstcolor: #003b64;
$secondcolor: #1677bb;
$thirdcolor: #333333;

$facebook: #3b5998;
$twitter: #55acee;

input[type=password]::-ms-reveal, input[type=password]::-ms-clear { display: none; } /* Removing this since I'll add it myself for browser compatibility */
input[type="email"], input[type="password"], input[type="submit"] { @include border-radius(360px, 360px, 360px, 360px); }
input[type="email"], input[type="password"] { padding-left: 2.75em; }
input[type="submit"] {
	width: 100%;
	background-color: $firstcolor;
	color: white;
	border: 0;
	padding: 8px;
	@include transition(0.25s);
}
input[type="submit"]:hover {
	background-color: $secondcolor;
}

label {
	display: inline;
	position: absolute;
	top: 0.65em;
	left: 2.30em;
	color: #999999;
}

form {
	position: relative;
	top: 50%;
	-webkit-transform: translateY(-50%);
	-ms-transform: translateY(-50%);
	transform: translateY(-50%);
}

form .row .row { margin: 0 -0.9375rem }

body { color: #999999; background-image: url('http://www.migloo.be/labs/lab1/img/background.jpg'); background-size: cover; }

p.intro1, p.intro2 {
	text-align: center;
	color:white;
	font-size: 0.9em;
	margin-bottom: 40px;
	font-family: 'Open Sans';
}

p.intro2 { opacity: 0; }

.wrapper, .morphHeader {
	font-family: $body;
	background-color: #f2f2f2;
	@include border-radius(6px, 6px, 6px, 6px);
}

.header, .footer, .morphHeader {
	text-align: center;
	text-transform: uppercase;
}
.header, .morphHeader {
	@include border-radius(6px, 6px, 0, 0);
	font-size: 1.7em;
	background-image: url('http://www.migloo.be/labs/lab1/img/backgroundBox.png');
	padding: 2em;
	color: white;
}
.username { padding-top: 1.25rem; }
.submit, .footer { padding-bottom: 1.25rem; }

.morphButton { z-index: 999; @include border-radius(360px, 360px, 360px, 360px); }
.morphButton, .morphHeader {
	opacity: 0;
	background-color: $secondcolor;
	text-align: center;
}
.loading, .success, .failure { color: white; line-height: 34px !important; text-align: center; }

.tooltip p { font-family: 'Open Sans'; font-size: 13px; line-height: 16px; }

.columns { position: relative; }
            
          
!
            
              var elements = [$(".intro1"), $(".username"), $(".password"), $(".submit"), $("#info .row")];
TweenMax.set($(".avatar"), {"opacity": 0, "display": "none"});

TweenMax.set([$(".wrapper"), elements], {"scale": 0, "opacity": 0});
TweenMax.set(elements, {"scale": 0, "opacity": 0});
TweenMax.set([$(".loading"), $(".success"), $(".failure")], {"scale": 0, "display": "none", "opacity": 0});

$(document).ready(function() {				
	TweenMax.to($(".wrapper"), 1.5, {"opacity":1, "scale":"1", ease: Power4.easeInOut, delay: 0.75});
	TweenMax.staggerTo(elements, 1, {"opacity":1, "scale":"1", ease:Expo.easeOut, delay: 1.75}, 0.1);
});

/* Click on the SUBMIT button */
$(".submit input[type='submit']").click(function(e) {
	e.preventDefault();

	var buttonAnim = $(".morphButton");
	buttonAnim.css({
		'width'		: $(this).outerWidth(),
		'height'	: $(this).outerHeight(),
		'position'	: 'absolute',
		'top'		: $(this).offset().top,
		'left'		: $(this).offset().left,
		'z-index'	: 999,
		'overflow'	: 'hidden'
	});

	var keepMeCentered = (($(".submit input[type='submit']").offset().left + (buttonAnim.width() / 2))) - $(".morphButton").height()/2;

	// if successful
	if($("#username").val() == "john@doe.com" && $("#password").val() == "test") {
		var timeline = new TimelineMax();
		timeline.to($(".morphButton"), 0, {"opacity": 1} )
				.to($(this), 0, {"opacity": 0, "visibility": "hidden"})
				.to($(".morphButton"), 0.5, {"width": $(".morphButton").height(), "left": keepMeCentered, ease:Back.easeInOut, onComplete:function(){
					TweenMax.to($(".loading"), 0.3, {"scale": "1", "display": "inline-block", "opacity": 1, ease: Power4.easeInOut, onComplete:function(){
						setTimeout(morphSuccess, 300) /* Faking a little the loading process */
					}});
				}}
		);
	}
	else {
		var timeline = new TimelineMax();
		timeline.to($(".morphButton"), 0, {"opacity": 1} )
				.to($(this), 0, {"opacity": 0, "visibility": "hidden"})
				.to($(".morphButton"), 0.5, {"width": $(".morphButton").height(), "left": keepMeCentered, ease:Back.easeInOut, onComplete:function(){
					TweenMax.to($(".loading"), 0.3, {"scale": "1", "display": "inline-block", "opacity": 1, ease: Power4.easeInOut, onComplete:function(){
						setTimeout(morphFail, 300) /* Faking a little the loading process */
					}});
				}}
		);
	}
});

function morphSuccess() {
	TweenMax.to($(".intro2"), 1, {"opacity": 0});
	var elements = [$(".username"), $(".password"), $(".submit")];

	var timeline = new TimelineMax();
	timeline.to($(".loading"), 1.5, {"scale": "0", "opacity": "0", ease: Elastic.easeIn, onComplete:function(){ $(".loading").css("display", "none"); } })
			.to($(".morphButton"), 0.5, {"backgroundColor": "#0f9d58", ease:Back.easeInOut})
			.to($(".success"), 1, {"scale": "1", "opacity": "1", "display": "inline-block", ease: Elastic.easeOut}, "-=0.3")
			.staggerTo(elements, 0.5, {"scale": 0, "opacity": 0, ease:Back.easeIn, onComplete:function(){
				var headerAnim = $(".morphHeader");
				headerAnim.css({
					'width'		: $(".wrapper").outerWidth(),
					'height'	: $(".header").outerHeight(),
					'position'	: 'absolute',
					'top'		: $(".wrapper").offset().top,
					'left'		: $(".wrapper").offset().left,
					'z-index'	: 100,
					'overflow'	: 'hidden',
					'opacity'	: 1
				});
				TweenMax.set($(".header"), {"opacity": 0});
				TweenMax.to($(".morphHeader span"), 0.5, {"opacity": 0});
				TweenMax.to($(".morphHeader"), 0.5, {"padding": 0, "height": ($(".wrapper").outerHeight()+"px"), "line-height": (($(".wrapper").outerHeight()-150)+"px"), onComplete:function(){
					$(".morphHeader span").html("Welcome John!");
					TweenMax.to($(".morphHeader span"), 0.25, {"opacity": 1})
					TweenMax.to($(".success"), 0.5, {"opacity": 0, onComplete:function(){
						$(".success").css("display", "none");
						$(".avatar").css("display", "block");
						TweenMax.to($(".avatar"), 1, {"opacity": 1});
						TweenMax.to($(".morphButton"), 0.5, {
							"left": ($(".morphButton").offset().left - 55)+"px",
							"top": ($(".morphButton").offset().top - 130)+"px",
							"width": "150px", "height": "150px", ease: Power4.easeInOut
						});
					}})
				}});
			}}, 0.1)
	;
}

function morphFail() {
	var timeline = new TimelineMax();
	timeline.to($(".loading"), 1.5, {"scale": "0", "opacity": "0", ease: Elastic.easeIn, onComplete:function(){ $(".loading").css("display", "none"); } })
			.to($(".morphButton"), 0.5, {"backgroundColor": "#cc231a", ease:Back.easeInOut, onComplete:function() {
				TweenMax.to($(".failure"), 0.5, {"scale": "1", "opacity": "1", "display": "inline-block", ease: Elastic.easeOut}, "-=0.3"); TweenMax.to([$(".wrapper"), $(".morphButton")], 0.1, {x:"+=10", yoyo:true, repeat:5, ease:Power4.easeInOut});
			}})
			.to([$(".failure"), $(".morphButton")], 0.5, {"opacity": "0", delay: 1})
			.to($(".morphButton"), 0.3, {"width": $(".submit input[type='submit']").outerWidth(), "backgroundColor": "#1677bb", "left": "-1000px"})
			.set([$(".success"), $(".failure")], {"display": "none"})
			.to($(".submit input[type='submit']"), 0, {"opacity": 1, "visibility": "visible", onComplete:function(){
				TweenMax.to($(".intro1"), 1, {"opacity": 0})
				TweenMax.to($(".intro2"), 1, {"opacity": 1})
			}})
	;
}

$(window).resize(function(){
	$(".morphButton").css("left", (($(".submit input[type='submit']").offset().left + ($(".morphButton").width() / 2) ) - $(".morphButton").height()/2)+"px");
	$(".morphButton").css("top", $(".submit input[type='submit']").offset().top);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console