Add anchor points to post list page

* post-year now has anchor point, you can click on it or input url with hash tag to jump to a specific year.
* See #39
This commit is contained in:
Track3 2019-03-24 11:45:41 +08:00
parent e6177e0fde
commit 028dc62e3b
7 changed files with 16 additions and 5 deletions

View file

@ -86,6 +86,12 @@ if (header !== null) {
listen('#img-btn', "click", showImg);
listen('.bg-img', "click", hideImg);
document.querySelectorAll('.post-year').forEach((ele)=> {
ele.addEventListener('click', () => {
window.location.hash = '#' + ele.id;
});
});
window.addEventListener('scroll', throttle(() => {
autoHideHeader();

View file

@ -408,6 +408,11 @@ p.img-404 {
margin-right: 1.8em;
font-size: 1.6em;
@include dimmed;
&:hover {
text-decoration: underline;
cursor: pointer;
}
}
.posts-list {