mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-04-21 03:17:28 +08:00
fix: make post page scroller sticky and restore comment hash navigation
This commit is contained in:
@@ -572,8 +572,9 @@ export default {
|
|||||||
const id = hash.substring('#comment-'.length)
|
const id = hash.substring('#comment-'.length)
|
||||||
await nextTick()
|
await nextTick()
|
||||||
const el = document.getElementById('comment-' + id)
|
const el = document.getElementById('comment-' + id)
|
||||||
if (el && mainContainer.value) {
|
if (el) {
|
||||||
mainContainer.value.scrollTo({ top: getTopRelativeTo(el, mainContainer.value), behavior: 'instant' })
|
const top = el.getBoundingClientRect().top + window.scrollY
|
||||||
|
window.scrollTo({ top, behavior: 'instant' })
|
||||||
el.classList.add('comment-highlight')
|
el.classList.add('comment-highlight')
|
||||||
setTimeout(() => el.classList.remove('comment-highlight'), 2000)
|
setTimeout(() => el.classList.remove('comment-highlight'), 2000)
|
||||||
}
|
}
|
||||||
@@ -671,6 +672,9 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 15%;
|
width: 15%;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
align-self: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-config-container {
|
.comment-config-container {
|
||||||
|
|||||||
Reference in New Issue
Block a user