Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Infinite Scroll

Implement infinite scrolling for the dinosaur list.

Task

The index.html file has a scrollable list #dino-list (style.css gives it a height of 300 px and overflow-y: auto). The script loads dinosaurs 10 at a time. Fill in the blanks: ___BLANK1___ is the method that adds a new li element at the end of the list, and ___BLANK2___ is the property with the height of the whole list content (scrollTop is the scrolled pixels, clientHeight the height of the visible window). When less than 50 pixels are left to the end of the list, it should load the next 10 items, and add nothing before that.