Closed chopfitzroy closed 7 years ago
If an element has existing inline styles, ScrollReveal will preserve them—but anything added after reveal()
has been invoked, will be overwritten. That means regardless of what ScrollReveal callback you use, it will always be too late to apply inline styles.
Some things you could try:
<div>
and apply your styles to that (still within beforeReveal
).beforeReveal
).reveal()
(outside beforeReveal
).
I have the following code (forgive the ugliness of it was just prototyping):
So basically I want to apply a calculated
top
property to the element before it animates, the problem is that while thetop
appears to be applied, it is then immediately overwritten when the element is being animated. I am not sure if this is the expected behaviour and if so I could apply the top first and then animate it using a callback, it just felt cleaner usingbeforeReveal
. As a side note if I use theafterReveal
it works but it animates in and then re-positions.Thanks!