Become a member
Sign in
How to auto-scroll to the bottom of a div
299
3
Heather Booker
Nicolas Zimmermann
Nicolas Zimmermann
Nov 6 · 1 min read

Should do:

var end = someElement.scrollHeight - someElement.clientHeight;

instead of:

var end = someElement.scrollHeight

So that if the scroll will only try to scroll to the actual bottom of the view and not any further

  • JavaScript
  • Vuejs
  • UX
Nicolas Zimmermann

Written by

Nicolas Zimmermann

Write the first response

Discover Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Make Medium yours

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Become a member

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade
AboutHelpLegal