Skip to content

Instantly share code, notes, and snippets.

View beseidel's full-sized avatar

Barbara Seidel beseidel

View GitHub Profile
@beseidel
beseidel / completed-animated-form.markdown
Created July 20, 2019 19:44
Completed Animated Form
@beseidel
beseidel / form-animation-on-focus-js-and-css.markdown
Created July 20, 2019 19:47
Form Animation on Focus JS and CSS

Form Animation on Focus JS and CSS

UPDATE: This is now pure JavaScript. It was jQuery. UPDATE: Using delegates instead of loops with event listeners. UPDATE: Added check for inputs with values already set, adds 'focus' class to parent. This is a pretty simple example of how to animate form elements on the focus event. The order of the input and label elements is important. The CSS targets the next sibling of the input, which gets the focus event. There are probably other ways to do this with just JS, but I like this because it works regardless of the form blocks or form width. It takes advantage of flexbox. JS is simply adding the class. The rest is CSS.

A Pen by sinrise on CodePen.

License.

@beseidel
beseidel / index.html
Created July 20, 2019 19:51
Labels in Input Animation, Form Validation
<form class="validate-form">
<div class="form-group">
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="[email protected]" required title="please enter an email address">
<label for="exampleInputEmail1">Email address</label>
</div>
<div class="form-group">
<input type="password" class="form-control validate-form" id="examplePassword" placeholder="Numbers Letters Symbols" required >
<label for="examplePassword">Password</label>
</div>
</form>
@beseidel
beseidel / index.html
Created July 20, 2019 20:00
SASS Animated Form Labels
<form class="awesome-form">
<div class="input-group">
<input type="text">
<label>Your Full Name</label>
</div>
<div class="input-group">
<input type="email">
<label>Your Email Address</label>
@beseidel
beseidel / animated-social-buttons.markdown
Last active July 21, 2019 04:00
Animated Social Buttons