File size: 864 Bytes
eb29f4f
 
b022cd3
 
12761b6
b022cd3
 
 
 
 
34e64ec
b022cd3
 
34e64ec
eeff4b0
b022cd3
 
 
eeff4b0
b022cd3
 
 
12761b6
 
b022cd3
 
eeff4b0
b022cd3
eb29f4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function gradioCustomJS() {
	console.log("gradioCustomJS Started")

	//component-15
	const tabNav = document.querySelector("div.tab-nav")
	tabNav.addEventListener("mouseover", () => {
		tabNav.addEventListener("wheel", (event) => {
			event.preventDefault()
			let scrollLeft = 0
			if (Math.sign(event.deltaY) < 0) {
				scrollLeft = tabNav.scrollLeft - 15
			}
			if (Math.sign(event.deltaY) > 0) {
				scrollLeft = tabNav.scrollLeft + 15
			}
			tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
		})
	})

	tabNav.addEventListener("mouseout", () => {
		tabNav.removeEventListener("wheel", (event) => {
			event.preventDefault()
			// const scrollLeft = tabNav.scrollLeft + 10
			// tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
		})
	})

	return "Custom Gradio JS"
}