Slide down animation Angular 4

前端 未结 3 1025
忘掉有多难
忘掉有多难 2021-02-05 14:01

I am trying to animate my page but have the following issue:
I have content div on my page, and a button that opens another div above the content. I would like that div to

3条回答
  •  抹茶落季
    2021-02-05 14:30

    This is a clean and easy way to implement a slide down animation in angular 2+

    my-component.ts

    import { animate, style, transition, trigger } from '@angular/animations';
    @Component({
      animations: [
        trigger('slideDownUp', [
          transition(':enter', [style({ height: 0 }), animate(500)]),
          transition(':leave', [animate(500, style({ height: 0 }))]),
        ]),
      ],
    })
    

    my-component.html

    I am the content of the div!

    my-component.scss

    .box {
      overflow: hidden;
    }
    

提交回复
热议问题