Update javascript.js
Browse files- javascript.js +29 -24
javascript.js
CHANGED
@@ -1,24 +1,29 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
tabNav.
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function gradioCustomJS() {
|
2 |
+
console.log("gradioCustomJS Started")
|
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 |
+
const scrollLeft = tabNav.scrollLeft + event.deltaY
|
17 |
+
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
18 |
+
})
|
19 |
+
})
|
20 |
+
|
21 |
+
tabNav.addEventListener("mouseout", () => {
|
22 |
+
tabNav.removeEventListener("wheel", (event) => {
|
23 |
+
event.preventDefault()
|
24 |
+
const scrollLeft = tabNav.scrollLeft + event.deltaY
|
25 |
+
tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
|
26 |
+
})
|
27 |
+
})
|
28 |
+
return "Custom Gradio JS"
|
29 |
+
}
|