This is preview!
It happens because using .show() or .hide() adds inline styles to your element. These inline styles do not get updated from your CSS media queries, so the sidebar stays hidden or stays visible when you resize.
"Actually, I notice the opposite problem. I start with a wide page, and when I make the page narrow, the sidebar fails to hide."