Closed iuscare closed 2 years ago
Hey @iuscare,
Thanks for the report!
It seems like this could indeed be an improvement of our Figure
component as it is never terminated, triggering the mounted
method each time it appears but without any effect as the image is already loaded.
This behaviour is not intended, as this component only aims to lazy-load images. We have the ScrollAnimation
and ScrollReveal
components for advanced animation based on the scroll state.
I will add this to our to-do list for the next release.
Hi there,
just ported over your wonderful figure element and played around a little bit with it. I recognized that there doesn't seem to be an
unobserve
call once the images have been lazy loaded, because inwithMountWhenInView.js
is nodestroyed
method defined andterminated
is not being called. This leads to retriggering themounted()
function when scrolling the element(s) in view again without any effects. For a classic lazy loading functionality we might want to unobserve the element after thesrc
has been exchanged or is this intended by design (e.g. to retrigger more advanced visual animations in both directions)? If it is intended I guess I could simply extend the figure class and callthis.$emit('terminate')
within thedestroyed
function to get the expected behavior so this question is just for clarity and maybe for a little improvement for you if this was not intended that way.