How to detect if an element is visible on screen (straightforwardly)

Have you ever needed to know if an element is visible in the viewport or if the user has scrolled down and it’s not in view anymore? Below…