This Javascript program tracks scroll depth through a news article webpage, when a user scrolls their window to 25%, 50%, 100% of the article body. It dispatches an event to the window object at each of these scroll offsets. The offset percentage is included in the details of the event.
- Open a web browser
- Navigate to the following page: https://metro.co.uk/2024/08/10/pointless-london-gallery-crowned-uks-biggest-tourist-let-down-21393090/
- Right click -> Inspect element -> Console tab -> Paste the code from index.js
- Start scrolling and see events and console message being triggered when you have scrolled 25%, 50%, 100% of the article body