From 81bcfcbaba2274f6a3f2461db572d3bffa708900 Mon Sep 17 00:00:00 2001 From: Svetlana Korobtseva Date: Mon, 23 Sep 2024 23:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B0=D0=BB=D1=8F=D1=80=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demos/images/dosvg-heart.svg | 1 + .../demos/images/dosvg-look.svg | 1 + .../demos/images/dosvg-paw.svg | 1 + .../demos/images/dosvg-sleep.svg | 1 + .../demos/images/dosvg.svg | 1 + .../demos/index.html | 58 ++++++++++++------- 6 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 recipes/horizontal-scroll-with-shadow/demos/images/dosvg-heart.svg create mode 100644 recipes/horizontal-scroll-with-shadow/demos/images/dosvg-look.svg create mode 100644 recipes/horizontal-scroll-with-shadow/demos/images/dosvg-paw.svg create mode 100644 recipes/horizontal-scroll-with-shadow/demos/images/dosvg-sleep.svg create mode 100644 recipes/horizontal-scroll-with-shadow/demos/images/dosvg.svg diff --git a/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-heart.svg b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-heart.svg new file mode 100644 index 0000000000..b3b9623602 --- /dev/null +++ b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-heart.svg @@ -0,0 +1 @@ + diff --git a/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-look.svg b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-look.svg new file mode 100644 index 0000000000..5fa331e8a9 --- /dev/null +++ b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-look.svg @@ -0,0 +1 @@ + diff --git a/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-paw.svg b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-paw.svg new file mode 100644 index 0000000000..c42c41b9f7 --- /dev/null +++ b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-paw.svg @@ -0,0 +1 @@ + diff --git a/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-sleep.svg b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-sleep.svg new file mode 100644 index 0000000000..0328d0274d --- /dev/null +++ b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg-sleep.svg @@ -0,0 +1 @@ + diff --git a/recipes/horizontal-scroll-with-shadow/demos/images/dosvg.svg b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg.svg new file mode 100644 index 0000000000..0521d0ad72 --- /dev/null +++ b/recipes/horizontal-scroll-with-shadow/demos/images/dosvg.svg @@ -0,0 +1 @@ + diff --git a/recipes/horizontal-scroll-with-shadow/demos/index.html b/recipes/horizontal-scroll-with-shadow/demos/index.html index adf5c4d645..ceadd5cbfd 100644 --- a/recipes/horizontal-scroll-with-shadow/demos/index.html +++ b/recipes/horizontal-scroll-with-shadow/demos/index.html @@ -4,10 +4,6 @@ Горизонтальный скролл с тенями - - - - @@ -110,17 +133,8 @@ const scrollLeft = container.scrollLeft; const maxScrollLeft = container.scrollWidth - container.clientWidth; - if (scrollLeft > 10) { - shadowLeft.classList.remove('scroll-shadow__shadow--hide'); - } else { - shadowLeft.classList.add('scroll-shadow__shadow--hide'); - } - - if (scrollLeft < maxScrollLeft - 10) { - shadowRight.classList.remove('scroll-shadow__shadow--hide'); - } else { - shadowRight.classList.add('scroll-shadow__shadow--hide'); - } + shadowLeft.classList.toggle('scroll-shadow__shadow--hide', scrollLeft <= 10); + shadowRight.classList.toggle('scroll-shadow__shadow--hide', scrollLeft >= maxScrollLeft - 10); } container.addEventListener('scroll', updateShadows);