Use window.matchMedia instead of manually measuring to detect the presense of the sidebar.