Skip to content

Instantly share code, notes, and snippets.

@dacur
Created November 26, 2014 17:57
Show Gist options
  • Select an option

  • Save dacur/6234d5eeb6fa8d84e28e to your computer and use it in GitHub Desktop.

Select an option

Save dacur/6234d5eeb6fa8d84e28e to your computer and use it in GitHub Desktop.
Animate a form: drops into view from the top of the page when 'add' button is clicked. When 'save' is clicked, it animates up and out of view again. No extra JS library needed.
function ShowAssertiveForm(){
$('.assertiveFormSlider').animate({
top: '400px'
}, 600);
}
function HideAssertiveForm(){
$('.assertiveFormSlider').animate({
top: '-400px'
}, 400);
SaveAssertiveForm();
}
// .assertiveFormSlider is the div that holds the form
#addAssertiveItem.assertiveFormSlider
p.font700 Opportunity to Be Assertive
textarea(id='assertiveOpportunityText', class='form-control', placeholder='Type opportunity here...')
p.font300 Use these tips to think through how you will express your needs and respond in the field below.
p.font700 How Will I Express My Needs:
textarea(id='assertiveExpressionText', class='form-control', placeholder='Type response here...', rows='4')
button.btn.btn-default.form-control.button.trackit#assertiveSaveBtn(type='button') Save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment