@pushword/js-helper 0.0.101 → 0.0.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushword/js-helper",
3
- "version": "0.0.101",
3
+ "version": "0.0.102",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
@@ -27,9 +27,14 @@ class ScrollYEnhancer {
27
27
  wheelScroll(element) {
28
28
  element.addEventListener('wheel', (evt) => {
29
29
  evt.preventDefault()
30
- element.classList.toggle('scroll-smooth')
30
+ //element.classList.toggle('scroll-smooth')
31
+ const before = element.scrollTop
31
32
  element.scrollTop += evt.deltaY
32
- element.classList.toggle('scroll-smooth')
33
+ const after = element.scrollTop
34
+ if (before === after) {
35
+ window.scrollBy(0, evt.deltaY / 2)
36
+ }
37
+ //element.classList.toggle('scroll-smooth')
33
38
  })
34
39
  return this
35
40
  }
@@ -127,9 +132,14 @@ class ScrollXEnhancer {
127
132
  evt.preventDefault()
128
133
  if (evt.target.closest('.enhance-scroll-y')) return
129
134
  if (window.isScrolling === true) return
130
- element.classList.toggle('scroll-smooth')
135
+ //element.classList.toggle('scroll-smooth')
136
+ const before = element.scrollLeft
131
137
  element.scrollLeft += evt.deltaY
132
- element.classList.toggle('scroll-smooth')
138
+ const after = element.scrollLeft
139
+ if (before === after) {
140
+ window.scrollBy(0, evt.deltaY / 2)
141
+ }
142
+ //element.classList.toggle('scroll-smooth')
133
143
  })
134
144
  }
135
145