1

I have a share image on click of which a Div appears which contains facebook and twitter sharing options but i want this Div to appear with some fading animation.

Here is my HTML code:-

<img  class="like_2" alt="image" (click) = "shareIt(i)" src="assets/img/Fwd Icons/share.png">
<div class="row" *ngIf="sharing==i">
    <section class="widget">
        <share-buttons  (click) = "closeShareIt(i)" [url]=" myFeed.contentUrl "
             [count]="false"
             [totalCount]="true"
             [defaultStyle]= "true"
             (popUpClosed) = "true"
             [google]="googleInner"
             [pinterest]="false"
             [linkedIn]="false"
             [tumblr]="tumblrInner"
             [reddit]="false"
             [stumbleUpOn]="false">
        </share-buttons>                
    </section>
</div>
Utkarsh Gautam
  • 211
  • 2
  • 4
  • 13

1 Answers1

0

You can look at the Angular2 animate docs.

https://angular.io/docs/ts/latest/guide/animations.html

However, if you are looking for something really easy to do then just use something like this ..

<div [ngClass]="{'animator': gogogo}" class="myel">i will animate</div>

then in your component class ..

gogogo=false;

ngOnInit() {
  setTimeout(() => {
    this.gogogo=true;
  }, 1000);
}

then in your css ..

.myel {
  opacity:0;
}

.myel.animator {
  opacity:1;
  transition:opacity 2s ease-in;
}
danday74
  • 52,471
  • 49
  • 232
  • 283