Detect when an element is shown


I have some elements that have some “complex” conditions to show. Example:

I would like to fire an event when the element is shown.

Is there any way do detect/receive an event when the “show” changes without duplicating the logic in my code?


What you are after is not Aurelia specific, but can be done using the Intersection Observer. The Mozilla link has code examples and nice explanations as to how it all works.

1 Like