My webpage has a layout where the content is on the left and the sidebar is on the right. When the screen width is less than or equal to 480px, the two divs are stacked one under the other at 100% widths. There's a "Show/Hide" button that appears to toggle the visibility of the sidebar when clicked. To achieve this, I'm using the code:
$(".sidebar .box").slideToggle(200);
You can see everything in action on this jsfiddle link.
The issue I'm facing is that when I switch from wide screen to narrow screen (width <= 480px) and click the button again, it causes a back and forth bug.
I'm trying to figure out where I've gone wrong. Any help would be appreciated!