Fix IE7 bug which causes the TOC to immediately close after opening
[exim-website.git] / templates / web / doc / chapter.js
index 47c246041e3385910ca14637bae6b8d333760f58..988bf6a45ecf1c3911806577c89d3f4c60c1a846 100644 (file)
@@ -2,6 +2,7 @@
 (function ($) {
 
     var click_func = function (e) {
+        e.stopPropagation();
         if ($('#toc').data('opened')) {
             $('#toc > *').animate({
                 left: '-=' + $('#toc > ul').width() + 'px'
         }
     };
 
+    $('body').click(function () {
+        if( $('#toc').data('opened') ) $('#toc > img').mousedown();
+    });
+
     var type = document.location.pathname.match(/\/doc\/html\/spec_html\/filter/) ? 'filter' : 'spec';
 
     // Get the relevant table of contents
@@ -42,9 +47,9 @@
             $ul.removeClass('hidden').css('visibility', 'hidden').appendTo('#toc').css('left', '-' + $ul.width() + 'px').css('visibility', 'visible');
             $('#toc > img').mousedown(click_func);
             $('#toc > ul').click(click_func);
-            $('#toc a').click(function (e) {
+            $('#toc, #toc a').click(function (e) {
                 e.stopPropagation()
             });
         });
     });
-})(jQuery);
\ No newline at end of file
+})(jQuery);