diff --git a/assets/styles/post.styl b/assets/styles/post.styl index 39c6f46..94d8f52 100644 --- a/assets/styles/post.styl +++ b/assets/styles/post.styl @@ -322,7 +322,7 @@ margin-y($top, $bottom = $top) [data-target] outline 2px solid transparent outline-offset -1px - animation target-blink 3s ease 1 both + animation target-blink 5s ease 1 both .hljs-attr color #c5e478 @@ -331,10 +331,11 @@ margin-y($top, $bottom = $top) 0% outline-color #8fbcff - 5% - 15% + 3% + 9% outline-color #0052cc - 10% + 6% + 12% 80% outline-color #8fbcff diff --git a/plugins/target.js b/plugins/target.js index 9be0243..ba40a9d 100644 --- a/plugins/target.js +++ b/plugins/target.js @@ -1,15 +1,19 @@ +let target + +function clearTarget () { + if (!target) { + return + } + + delete target.dataset.target +} + export default ({ app }) => { - let target - - document.documentElement.addEventListener('click', () => { - if (!target) { - return - } - - delete target.dataset.target - }) + document.documentElement.addEventListener('click', clearTarget) app.router.afterEach(to => { + clearTarget() + if (!to.hash) { return }