123

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.

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.

            
              <section class="wrapper">
	
		<button class="send-message_bounce" arial-label="Show form to sign up for notifications">
			<p class="fade fadeOut">Newsletter</p>
		</button>
	
		<form id="newsletter" class="form-wrapper">
			<input class="form email-field" type="email" aria-label="Enter the email you want notifications sent to" placeholder="your@email.com" required />
			<input class="form submit-btn" type="submit" aria-label="Submit form" value="Subscribe"/>
		</form>
	
</section>


<a class="inspo-link" href="https://dribbble.com/shots/3072293-Notify-me" target="_blank">
	Inspired by Notify Me
</a>


            
          
!
            
              $theme-color: #6fcc9c;
$base-font: 1.2rem;

body {
	background-color: #f2f2f2;
	font-family: 'Nunito', sans-serif;
}

.wrapper {
	width: 25em;
  margin: auto;
  height: 4em;
  position: absolute;
  left: 20%;
  top: 50%;
}

.form-wrapper {
	width: 97%;
	height: 3em;
	margin: auto;
  transform: translate(0.2em, -3em);
}

.send-message_bounce {
	z-index: 1;
	display: inline;
	position: relative;
	width: 8em;
	height: 2.5em;
	margin: auto;
	padding: 0;
	font-size: $base-font;
	line-height: 20%;
	letter-spacing: 0.05rem;
	font-weight: 600;
	border-radius: 2em;
	border: none;
	cursor: pointer;
	transform-origin: 10% 100%;
  transform: translatex(7em);
	transition: all 200ms linear 0s;
	background-color: lighten(saturate($theme-color, 100%), 100%);
	box-shadow: 0px 4px 10px 2px rgba(0, 0, 0, 0.1);
	animation: null 400ms cubic-bezier(0.71, 0.55, 0.62, 1.57) both;
	border: 2px solid $theme-color;
		&:hover {
		background-color: lighten(saturate($theme-color, 100%), 90%);
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
}


.fadeOut {
	animation: null 300ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 100ms both;
}

.fade {
	opacity: 0;
	color: lighten(desaturate($theme-color, 100%), 100%);
	animation: scaleInUp 600ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 50ms both;
}

.form {
	display: inline;
	float: left;
	opacity: 0;
	border-radius: 3em;
}

.email-field:focus,
.send-message_bounce:focus,
.submit-btn:focus {
	outline: none;
}

.email-field {
	z-index: 3;
	width: 53%;
  padding: 0.65em 0em 0.7em 0.95em;
	border: 0px;
	color: $theme-color;
	border-radius: 3em;
	background-color: transparent;
	transform: translate(-30%, 0%);
	font-size: $base-font;
	animation: null 500ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 300ms both;
}

.email-field::placeholder {
	color: lighten(desaturate($theme-color, 5%), 15%);
	font-size: $base-font;
}

.submit-btn {
	background-color: darken($theme-color, 5%);
	color: lighten(desaturate($theme-color, 100%), 100%);
	width: 40%;
  margin-top: 1.3%;
  height: 2em;
  font-size: $base-font;
	letter-spacing: 0.05em;
  padding: 0px;
  border: none;
	font-weight: 600;
	cursor: pointer;
	animation: null 500ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 300ms both;
}

.submit-btn:hover {
	background-color: saturate($theme-color, 20%);
	color: lighten(desaturate($theme-color, 100%), 100%);
}

@keyframes scaleInUp {
  from {
    opacity: 0;
		color: #fff;
    transform: scale(0.8, 0.8) translatey(90%); 
	}
  to {
    opacity: 1;
		color: $theme-color;
    transform: scale(1, 1) translatey(0%); 
	} 
}

@keyframes appearNGrow {
	0% {
		width: 8em;
		transform: translatex(7em);
		z-index: 1;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
	80% {
		width: 21em;
		transform: translatex(0.5em);
		z-index: -1;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
	100% {
		width: 20em;
		transform: translatex(0.5em);
		z-index: -1;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
}

@keyframes appearForm {
	0% {
		opacity: 0; 
		transform: scale(0.8, 0.8); 
	}
	100% {
		opacity: 1;
		transform: scale(1, 1); 
	}
}

@keyframes scaleOut {
	from {
		opacity: 1;
		color:  $theme-color;
		transform: scale(1, 1) translatey(0%); 
	}
	to {
		opacity: 0;
		color: #fff;
		transform: scale(1, 1) translatey(-90%); 
	}
}

@keyframes scaleOutForm {
	from {
		opacity: 1;
		color:  $theme-color;
		transform: scale(1, 1); 
	}
	to {
		opacity: 0;
		color: #fff;
		transform: scale(0.2, 0.2); 
	}
}

@keyframes appearNShrink {
	0% {
		width: 20em;
		transform: translatex(0.5em);
		z-index: 1;
		border: 2px solid $theme-color;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
	100% {
		width: 8em;
		transform: translatex(7em);
		z-index: -1;
		background-color: $theme-color;
		color: #fff;
		border: 4px solid $theme-color;
		box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0);
	}
}

@keyframes scaleInUpWhite {
  0% {
    opacity: 0;
		color: $theme-color;
    transform: scale(0.8, 0.8) translatey(90%); 
	}
	80% {
		 transform: scale(1.2, 1.2) translatey(0%); 
	}
  100% {
    opacity: 1;
		color: #fff;
    transform: scale(1, 1) translatey(0%); 
	} 
}


.inspo-link {
	text-decoration: none;
	position: absolute;
	bottom: 3%;
	right: 3%;
	color: #444;
	font-size: 0.8em;
	transition: all 150ms ease-in 50ms;
	&:before {
		content: "";
		position: absolute;
		display: block;
		height: 0.2em;
		width: 100%;
		background-color: #444;
		bottom: -15%;
		transition: all 150ms ease-in 0s;
	}
	&:hover {
		color: #000;
	}
	&:hover:before {
		height: 0.4em;
		background-color: #000;
	}
}


            
          
!
            
              const btn = document.querySelector('.send-message_bounce'),
 			form = document.querySelector('.email-field'),
 			fade = document.querySelector('.fadeOut'),
			submit = document.querySelector('.submit-btn');

// btn to email form
const elements = new Map([
	[btn, 'appearNGrow'],
	[fade, 'scaleOut'],
	[form, 'appearForm'],
	[submit, 'appearForm']
]);

btnToForm = () => {
		btn.addEventListener('click', expandForm);
}

expandForm = () => {
	getProperties(elements);
}

getProperties = (obj) => {
	for(let item of obj) {
		addName(item);
	}
}

addName = ([el, name]) => {
	el.style.animationName = `${name}`;
}

btnToForm();


// form to thank you message

formToThank = () => {
	const theform = document.getElementById('newsletter');
	theform.addEventListener('submit', closeForm);
}

closeForm = (e) => {
	e.preventDefault();
	fade.innerHTML = "Thank You!";
	form.style.animation = "scaleOutForm 500ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 100ms both";
	submit.style.animation = "scaleOutForm 400ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 100ms both";
	btn.style.animation = "appearNShrink 300ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 300ms both"
	fade.style.animation = "scaleInUpWhite 400ms cubic-bezier(0.71, 0.55, 0.62, 1.57) 700ms both";
}

formToThank();

            
          
!
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.

Console