From 9ac870e0a54ee1e01f56e398d5beefdf2cb1b174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 13 Sep 2017 14:05:18 +0200 Subject: [PATCH] Fixed scrolling to comment when the comment ID is in the URL hash. --- src/templates/nodes/custom/comment/list_embed.pug | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/templates/nodes/custom/comment/list_embed.pug b/src/templates/nodes/custom/comment/list_embed.pug index 398f2dac..cb328689 100644 --- a/src/templates/nodes/custom/comment/list_embed.pug +++ b/src/templates/nodes/custom/comment/list_embed.pug @@ -78,6 +78,15 @@ | {% block comment_scripts %} script. + function scrollToLinkedComment() { + var scrollToId = location.hash; + if (scrollToId.length <= 1) return; + + $(scrollToId) + .addClass('comment-linked') + .scrollHere(); + } + $(scrollToLinkedComment); // Markdown initialization var convert = new Markdown.getSanitizingConverter();