Use JavaScript to detect CSS variables on resize