- function openSidebar() {
- if (arguments.length) { $("sidebar").style.width = arguments[0]; }
- else { $("sidebar").style.width = "30%"; }
+ var onclose;
+
+ function openSidebar(options) {
+ options = options || {};
+
+ if (onclose) {
+ onclose();
+ onclose = null;
+ }
+
+ if (options.width) { $("sidebar").style.width = options.width; }
+ else { $("sidebar").style.width = "30%"; }
+