Im doing a small proyect with litelement, but I want to fire an event when a webcomponent is shown, not only the first time, but every time that the component shows, how can I do that?
thanks in advance
Im doing a small proyect with litelement, but I want to fire an event when a webcomponent is shown, not only the first time, but every time that the component shows, how can I do that?
thanks in advance
Copyright © 2021 Jogjafile Inc.
Intersection Observer API will help you find if the element is on the screen. For more information, visit MDN docs.
The API is supported on all browsers except IE but a polyfill is already available: https://github.com/w3c/IntersectionObserver