website: add anchor positioning style. 4122b48f76

This commit is contained in:
jaywcjlove
2022-10-15 18:23:38 +00:00
parent 693aa974a1
commit 3e19a9efad
44 changed files with 780 additions and 44 deletions

View File

@ -313,5 +313,22 @@
<table class="shortcuts"><thead><tr><th align="left">:-</th><th align="left">:-</th></tr></thead><tbody><tr><td align="left"><code>Up</code>, <code>Alt-k</code></td><td align="left">在流程列表中选择(突出)<code></code>一个流程</td></tr><tr><td align="left"><code>Down</code>, <code>Alt-j</code></td><td align="left">在流程列表中选择(突出)<code></code>一个流程</td></tr><tr><td align="left"><code>Left</code>, <code>Alt-h</code></td><td align="left"><code></code>滚动流程列表</td></tr><tr><td align="left"><code>Right</code>, <code>Alt-l</code></td><td align="left"><code></code>滚动进程列表</td></tr><tr><td align="left"><code>PgUp</code>, <code>PgDn</code></td><td align="left">将流程列表<code>向上</code><code>向下</code>滚动一个窗口</td></tr><tr><td align="left"><code>Home</code></td><td align="left">滚动到流程列表的<code>顶部</code> <br> <em>选择第一个流程</em></td></tr><tr><td align="left"><code>End</code></td><td align="left">滚动到流程列表的<code>底部</code> <br> <em>选择最后一个流程</em></td></tr><tr><td align="left"><code>Ctrl-A</code>, <code>^</code></td><td align="left"><code></code>滚动到流程条目<code>开头</code> <em>(即行开头)</em></td></tr><tr><td align="left"><code>Ctrl-E</code>, <code>$</code></td><td align="left"><code></code>滚动到流程条目<code>末尾</code> <em>(即行尾)</em></td></tr></tbody></table>
<!--rehype:className=shortcuts-->
</div></div></div></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang, All rights reserved.</footer></footer></body>
</div></div></div></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang, All rights reserved.</footer></footer><script>
if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
window.onhashchange = function () {
anchorPoint()
};
}
function anchorPoint() {
const hash = window.location.hash?.replace(/^#/, '') || '';
const elm = document.getElementById(decodeURIComponent(hash));
Array.from(document.querySelectorAll('.h2wrap-body .wrap')).forEach((elm) => elm.classList.remove('active'))
if (elm?.tagName === 'H3') {
elm?.parentElement?.parentElement?.classList.add('active');
const box = elm?.parentElement?.parentElement;
console.log('elm:2', box, document.querySelectorAll('.h2wrap-body .wrap'))
}
}
anchorPoint();
</script></body>
</html>