Sha256: 50e1309dd13222ee88787bd6662a391ac894e23f8044fe151fd20eb13dc695fd
Contents?: true
Size: 529 Bytes
Versions: 13
Compression:
Stored size: 529 Bytes
Contents
/** * Scroll smoothly to the last message automatically when the page is fully loaded. * To apply this to a page, at least one element must have the class "scroll-to-last-message". * * @param {HTMLElement} node target node * @returns {void} */ export default function(node = document) { const element = node.querySelector("[data-scroll-last-child]") if (element && element.children.length) { const lastChild = [...element.children].pop() window.scrollTo({ top: lastChild.offsetTop, behavior: "smooth" }); } }
Version data entries
13 entries across 13 versions & 1 rubygems