Update javascript.js
Browse files- javascript.js +4 -3
javascript.js
CHANGED
|
@@ -3,17 +3,18 @@ function gradioCustomJS() {
|
|
| 3 |
|
| 4 |
//component-15
|
| 5 |
const tabNav = document.querySelector("#component-153 > div.tab-nav.svelte-1uw5tnk")
|
| 6 |
-
|
| 7 |
tabNav.addEventListener("wheel", (event) => {
|
| 8 |
event.preventDefault()
|
| 9 |
const scrollLeft = tabNav.scrollLeft + event.deltaY
|
| 10 |
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
| 11 |
-
})
|
| 12 |
|
| 13 |
tabNav.addEventListener("mouseover", () => {
|
| 14 |
tabNav.addEventListener("wheel", (event) => {
|
| 15 |
event.preventDefault()
|
| 16 |
-
|
|
|
|
| 17 |
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
| 18 |
})
|
| 19 |
})
|
|
|
|
| 3 |
|
| 4 |
//component-15
|
| 5 |
const tabNav = document.querySelector("#component-153 > div.tab-nav.svelte-1uw5tnk")
|
| 6 |
+
/*const tabNav = document.querySelector('.tab-nav')
|
| 7 |
tabNav.addEventListener("wheel", (event) => {
|
| 8 |
event.preventDefault()
|
| 9 |
const scrollLeft = tabNav.scrollLeft + event.deltaY
|
| 10 |
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
| 11 |
+
})*/
|
| 12 |
|
| 13 |
tabNav.addEventListener("mouseover", () => {
|
| 14 |
tabNav.addEventListener("wheel", (event) => {
|
| 15 |
event.preventDefault()
|
| 16 |
+
let scrollLeft = 0;
|
| 17 |
+
Math.sign(event.deltaY) < 0 && (scrollLeft = tabNav.scrollLeft - 20), Math.sign(event.deltaY) > 0 && (scrollLeft = tabNav.scrollLeft + 20);
|
| 18 |
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
| 19 |
})
|
| 20 |
})
|