Skip to content

Instantly share code, notes, and snippets.

@kmaida
Last active March 9, 2016 15:00
Show Gist options
  • Select an option

  • Save kmaida/91affeee4fabbce74ff4 to your computer and use it in GitHub Desktop.

Select an option

Save kmaida/91affeee4fabbce74ff4 to your computer and use it in GitHub Desktop.
AngularJS - Sass - Animating the height of an ng-if to achieve an expanding/collapsing effect. To animate ng-show/hide, see: http://codepen.io/kmaida/pen/QwgddQ
.animated-ng-if {
&.ng-enter {
transition: max-height 350ms ease-in; /* transition the height FROM 0 to x when entering (autoprefix or use mixin) */
max-height: 0;
}
&.ng-enter.ng-enter-active,
&.ng-leave {
max-height: 600px; /* max-height when active (adjust value to fit needs) */
}
&.ng-leave.ng-leave-active {
max-height: 0; /* height when collapsed */
}
&.ng-leave {
transition: max-height 350ms ease-out; /* transition the height FROM x to 0 when leaving */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment