diff options
| author | Track3 <pengliabc@live.cn> | 2019-03-24 11:45:41 +0800 |
|---|---|---|
| committer | Track3 <pengliabc@live.cn> | 2019-03-24 11:45:41 +0800 |
| commit | 028dc62e3b02a636e47f8c2b8484b3926f1a9cfb (patch) | |
| tree | 47b5d55399a4003e5ecd866f627978be1665b4c5 /assets | |
| parent | e6177e0fde4f3e3413c1c237c0ff9a8f55398687 (diff) | |
| download | hermit-028dc62e3b02a636e47f8c2b8484b3926f1a9cfb.tar.gz | |
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
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/main.js | 6 | ||||
| -rw-r--r-- | assets/scss/style.scss | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/assets/js/main.js b/assets/js/main.js index bd0ad59..5f0a47c 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -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(); diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 9ff07e7..be2c149 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -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 { |
