commento.js: add scroll into view based on hash
This commit is contained in:
parent
a22b49a112
commit
619231e32f
@ -1523,6 +1523,7 @@
|
||||
attrSet(footer, "style", "");
|
||||
|
||||
nameWidthFix();
|
||||
loadHash();
|
||||
}
|
||||
|
||||
|
||||
@ -1570,6 +1571,19 @@
|
||||
}
|
||||
|
||||
|
||||
function loadHash() {
|
||||
if (window.location.hash && window.location.hash.startsWith("#commento-")) {
|
||||
var el = $(ID_CARD + window.location.hash.split("-")[1]);
|
||||
if (el === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
classAdd(el, "highlighted");
|
||||
el.scrollIntoView(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global.main = function(callback) {
|
||||
root = $(ID_ROOT);
|
||||
if (root === null) {
|
||||
|
@ -55,4 +55,8 @@
|
||||
font-weight: 700;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.commento-highlighted {
|
||||
background: $yellow-0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user