From a3744f812ea75b03e3f8f453bd6242b6455081af Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 20 Aug 2020 15:25:24 +0300 Subject: [PATCH] CmsKit: Should focus on the comment area after login and return back https://github.com/abpframework/abp/issues/5073 --- .../CmsKit/Shared/Components/Commenting/Default.cshtml | 2 +- .../CmsKit/Shared/Components/Commenting/default.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml index 5246f9a0f1..b8118e99ca 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml @@ -87,7 +87,7 @@ ; } -
+

diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js index 2950f8239b..8cce108ee5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js @@ -135,6 +135,14 @@ }); } + function focusOnHash($container) { + if (location.hash === ''){ + return; + } + + $('html, body').animate({ scrollTop: $(location.hash).offset().top + $(this).height() / 2 }, 'slow'); + } + function init() { registerReplyLinks($widget); registerEditLinks($widget); @@ -142,6 +150,8 @@ registerUpdateOfNewComment($widget); registerSubmissionOfNewComment($widget); + + focusOnHash($widget); } return {