From b04c1b9aa01f45c4cbd32113396374deccf71c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Thu, 6 Oct 2022 13:57:37 +0800 Subject: [PATCH] :bug: Fixed the tool button scroll Y pixes. --- assets/js/utils.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/js/utils.js b/assets/js/utils.js index e509bd9..e34087e 100644 --- a/assets/js/utils.js +++ b/assets/js/utils.js @@ -24,23 +24,22 @@ HTMLElement.prototype.wrap = function(wrapper) { NexT.utils = { registerToolButtons: function() { - const comms_offset = document.getElementById('comments').getBoundingClientRect().top + window.scrollY; document.getElementById('goto-comments').addEventListener('click', () => { window.anime({ targets : document.scrollingElement, duration : 500, easing : 'linear', - scrollTop: comms_offset + scrollTop: document.getElementById('comments').getBoundingClientRect().top + window.scrollY }); }); - const gt_offset = document.getElementById('google_translate_element').getBoundingClientRect().top + window.scrollY; + document.getElementById('goto-gt').addEventListener('click', () => { window.anime({ targets : document.scrollingElement, duration : 500, easing : 'linear', - scrollTop: gt_offset + scrollTop: document.getElementById('google_translate_element').getBoundingClientRect().top + window.scrollY }); }); },