AI Frontend · Exercise 4 of 4 Previous
Intermediate
Follow Only the Reader Who Is at the Bottom
#add adds a line of text to the box #box. Make the box follow new lines (scroll to the bottom) only when the reader is already within 24 pixels of the bottom.
When the reader has scrolled up, do not move the box. Instead show the button #jump (it is hidden until then). Clicking #jump scrolls to the bottom and hides it again.
The box listens to its own scroll event to remember where the reader is.
What Check tests
- While the reader is at the bottom, new lines are followed and
#jumpstays hidden - After scrolling to the top,
#jumpappears - A new line does not move a reader who scrolled up
- Clicking
#jumpreturns to the bottom and hides the button
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.