-
-        vsplitbar.toggle(
-                       function() {
-                               $.wiki.state.perspectives.ScanGalleryPerspective.show = true;
-                               setSplitbarAt(splitterWidth - (480 + vsplitbarWidth));
-                               $('.vsplitbar').addClass('active');
-                               $(window).resize();
-                               $.wiki.perspectiveForTab('#tabs-right .active').onEnter();
-                       },
-                       function() {
-                           var active_right = $.wiki.perspectiveForTab('#tabs-right .active');
-                               $.wiki.state.perspectives.ScanGalleryPerspective.show = false;
-                               $(".vsplitbar-title").html("↑ " + active_right.vsplitbar + " ↑");
-                               setSplitbarAt(splitterWidth - vsplitbarWidth);
-                               $('.vsplitbar').removeClass('active');
-                               $(window).resize();
-                               active_right.onExit();
-                       }
-               );
+            $.wiki.perspectiveForTab($('#tabs-right .active').parent()).onEnter();
+
+            vsplitbar.on('click', function() {
+                var $this = $(this);
+                if ($this.hasClass('active')) {
+                    $.wiki.state.perspectives.ScanGalleryPerspective.lastWidth = sidebar.width();
+                    setSidebarWidth(0);
+               } else {
+                    setSidebarWidth($.wiki.state.perspectives.ScanGalleryPerspective.lastWidth);
+               }
+            });