Vikram
Vikram

Reputation: 3371

Load css file after page load to apply animations angular 4

On my angular 4 project I have added animation in a css file and added classes on elements to apply animation on page load, right now its not working on first page load and app takes time to load and css applies in between, once the page is loaded fully then they are working fine but I want them on first page load.

One solution is to load animation file after app load, but not sure how can I do it.

Second way is to use javascript to add classes on page load but then it will take time and requires code for different components.

Is there a way to do it ?

Any help is appreciable.

Upvotes: 1

Views: 1868

Answers (1)

Vega
Vega

Reputation: 28738

You can also add the styles directly in index.html inside <style> tag or directly on the element tag as inline style. So the styles would be loaded before the page is fully loaded and so can be applied ahead.

Upvotes: 3

Related Questions