angular 2 set style when window scrolls to element

420 Views Asked by At

In angular 2 can I do something like

<div (onEnter)="doSomething()">
</div>

which would trigger when the windows is near an element within a large component.

I am trying to avoid having to write a bunch of components with custom entrance animation. so I wanted to set the style to reference animate.css in the dosomething() function.

1

There are 1 best solutions below

2
On BEST ANSWER

Yes, only the syntax dictates (enter) rather than (onEnter).

Plus, you're using angular2, hence the proper usage is of LESS or SCSS files. For pre-processing style files read here http://lesscss.org/