diff --git a/public/views/html.hbs b/public/views/html.hbs
index 5ef5192..a300ddd 100644
--- a/public/views/html.hbs
+++ b/public/views/html.hbs
@@ -160,6 +160,29 @@
             removeHash();
         });
 
+        var toggle = $('.expand-toggle');
+        var tocExpand = false;
+
+        checkExpandToggle();
+        toggle.click(function (e) {
+            e.preventDefault();
+            e.stopPropagation();
+            tocExpand = !tocExpand;
+            checkExpandToggle();
+        })
+
+        function checkExpandToggle () {
+            var toc = $('.ui-toc-dropdown .toc');
+            var toggle = $('.expand-toggle');
+            if (!tocExpand) {
+                toc.removeClass('expand');
+                toggle.text('Expand all');
+            } else {
+                toc.addClass('expand');
+                toggle.text('Collapse all');
+            }
+        }
+
         function scrollToTop() {
             $('body, html').stop(true, true).animate({
                 scrollTop: 0