Made sidebar to open/collapse based on current visible content