+
@@ -908,6 +908,7 @@ class Search {
onScroll() {
const curScrollTop = this.$refs.scroller.scrollTop;
+ const toolpanelviewportoffset= this.$refs.toolPanel.getBoundingClientRect().top;
if (this.ignoreScrolling) {
this.lastScrollTop = curScrollTop;
@@ -916,24 +917,29 @@ class Search {
return;
}
+
+ if (this.lastScrollTop==curScrollTop) return; //если событие вызвано более 1 раза на 1 скролл
+
if (!this.lastScrollTop)
this.lastScrollTop = 0;
- if (!this.lastScrollTop2)
- this.lastScrollTop2 = 0;
-
- if (curScrollTop - this.lastScrollTop > 0) {
- this.$refs.toolPanel.style.position = 'relative';
- if (this.lastScrollTop2 <= curScrollTop - this.$refs.toolPanel.clientHeight)
- this.lastScrollTop2 = 0;
-
- this.$refs.toolPanel.style.top = `${this.lastScrollTop2}px`;
- } else {
- this.$refs.toolPanel.style.position = 'sticky';
- this.$refs.toolPanel.style.top = 0;
- this.lastScrollTop2 = curScrollTop;
- }
+ if (curScrollTop - this.lastScrollTop > 0) { //страницу крутят вверх
+ if (this.$refs.toolPanel.style.position=="sticky") //Если блок приклеен к окну
+ this.$refs.toolPanel.style.top=`${curScrollTop}px`;//Приклеиваем его к позиции в родителе
+ this.$refs.toolPanel.style.position="relative";
+ if (toolpanelviewportoffset<-this.$refs.toolPanel.offsetHeight) //Но не даём блоку оказаться дальше своей высоты за экраном
+ this.$refs.toolPanel.style.top = `${curScrollTop-this.$refs.toolPanel.offsetHeight}px`;
+ } else {
+ if (toolpanelviewportoffset>=0)
+ {
+ this.$refs.toolPanel.style.top="0px";
+ this.$refs.toolPanel.style.position="sticky";
+
+ }
+ }
this.lastScrollTop = curScrollTop;
+
+
}
async ignoreScroll(ms = 300) {
From f85c126d037e30e0348436c97a0724b332d296de Mon Sep 17 00:00:00 2001
From: Sergey Samsonov <47633867+Weegley@users.noreply.github.com>
Date: Thu, 5 Jan 2023 00:59:39 +0300
Subject: [PATCH 2/2] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D0=BE?=
=?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=88=D0=B0=D0=BF?=
=?UTF-8?q?=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BC=D0=B5=D0=BD?=
=?UTF-8?q?=D0=B5=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/components/Search/Search.vue | 2 ++
1 file changed, 2 insertions(+)
diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue
index f1037e9..1d61712 100644
--- a/client/components/Search/Search.vue
+++ b/client/components/Search/Search.vue
@@ -954,6 +954,8 @@ class Search {
scrollToTop() {
this.$refs.scroller.scrollTop = 0;
this.lastScrollTop = 0;
+ this.$refs.toolPanel.style.top="0px";
+ this.$refs.toolPanel.style.position="sticky";
}
updatePageCount() {