diff options
author | David Gay <david@davidgay.org> | 2021-06-10 09:27:38 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-10 09:27:38 -0400 |
commit | d4311291581f57cce1789155cc8ce8ae6fd80162 (patch) | |
tree | 5f513ba07f6c8ec5d02b2075b96c20bebe632f73 /app/javascript | |
parent | f00aea423bafe7889c7bcc8d85b3561e2c9606d9 (diff) |
Start results div scrolled to bottom on page changes
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/controllers/results_controller.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/javascript/controllers/results_controller.js b/app/javascript/controllers/results_controller.js new file mode 100644 index 0000000..266b80c --- /dev/null +++ b/app/javascript/controllers/results_controller.js @@ -0,0 +1,13 @@ +import { Controller } from "stimulus"; + +export default class extends Controller { + static targets = [ "output" ]; + + connect() { + this.scrollToBottom(); + } + + scrollToBottom() { + this.outputTarget.scrollTop = this.outputTarget.scrollHeight; + } +} |