You can put it on codesandbox.
It looks like you're debouncing the height change, so it's not going to be in sync with ScrollTrigger's refresh.
Also, this is a faulty assumption. My computer would be considered a touch device because I have a touch screen, even though I'm using my mouse. And browser vendors removed "ontouchstart" from the window object because of assumptions like this.
function isTouchDevice() {
return (
"ontouchstart" in window ||
navigator.maxTouchPoints > 0 ||
navigator.msMaxTouchPoints > 0
);
}