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/js | |
| 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/js')
| -rw-r--r-- | assets/js/main.js | 6 |
1 files changed, 6 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(); |
