We have an application where:
- Apply font-face
Lato
to body - Need to calculate
offset().top
value of some elements (for scroll-spy)
Now we calculate the value of offset().top
in an Angular link
function, which should be invoked after DOM is ready.
However, we found that the values are inaccurate. If we disable the font Lato
, the values become correct.
So we suspect that in the link
function, when we calculate, the font is not yet rendered to the body
, making the offset()
value incorrect.
How can we calculate only after the font is applied?
I have tried the solution given in How to know when font-face has been applied, but without luck.