diff options
author | dzwdz | 2025-02-10 17:20:49 +0100 |
---|---|---|
committer | dzwdz | 2025-02-10 17:20:49 +0100 |
commit | 6f155f27997a4ef9c9f40edf3baff73b5ba34e5b (patch) | |
tree | 3ca74fdb19d55aee29fec63346b0a0cefe0842e5 | |
parent | abf0a2ef258a4fc8fc2a47abb4f8fb6e70f50151 (diff) |
sticky acct header
-rw-r--r-- | app.js | 13 | ||||
-rw-r--r-- | treed.css | 5 |
2 files changed, 13 insertions, 5 deletions
@@ -175,7 +175,17 @@ let DayDigest = { let account = posts[0].account; return m("details.acct", {key: user}, [ - m("summary.acct__header", [ + m("summary.acct__header", { + onclick: (ev) => { + // Don't jump around when closing an acount which we see + // only due to position:sticky; + let el = ev.target.parentElement; + let el_y = el.getBoundingClientRect().top; + if (el_y < 0) { + window.scrollTo(window.scrollX, window.scrollY + el_y); + } + } + }, [ m("img.avatar", {src: account.avatar_static}), m("span.acct__username", account.display_name || account.acct), // TODO figure out where to show acct m("span.acct__counts.fg2", `${own_posts}o | ${replies}r | ${reblogs}b`), @@ -299,7 +309,6 @@ m.route(document.body, "/home", { if (!localStorage.instance || !localStorage.access_token) { m.route.set("/login"); - // TODO } else { m.route.set("/home"); let masto = new Mastodon(localStorage.instance, localStorage.access_token); @@ -32,11 +32,10 @@ body { display: flex; align-items: center; - /* TODO - background: #fff; + background: var(--background2); position: sticky; top: 0; - */ + border-bottom: 1px solid var(--border-color); margin-bottom: -1px; |