Skip to content

Instantly share code, notes, and snippets.

@JokingChicken
Last active June 17, 2018 20:53
Show Gist options
  • Save JokingChicken/6947aa770c9ec33e3285b82af458c3e4 to your computer and use it in GitHub Desktop.
Save JokingChicken/6947aa770c9ec33e3285b82af458c3e4 to your computer and use it in GitHub Desktop.
get the real scroll height of div
<script>
// calculate max scroll top position (go back to top once reached)
var maxScrollPosition = element.scrollHeight - element.clientHeight;
// example
element.scrollTop = maxScrollPosition;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment