From 527d3a4ceacaaa7c43a7b73e1c830288cfb5633b Mon Sep 17 00:00:00 2001 From: "Instructor, BCIT" Date: Tue, 23 Apr 2019 09:10:15 -0700 Subject: Merge pull request #5453 from popcorner/popcorner-toc [user guide] replace toggle() to fix the toc button --- .../_themes/sphinx_rtd_theme/static/js/theme.js | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 081d77bdf..911dad29b 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -22,31 +22,34 @@ $(document).ready(function () { $('#openToc').click(function () { $('#nav').slideToggle(); }); - $('#closeMe').toggle( - function () - { + $('#closeMe').click(function () { + if (getCookie('ciNav') != 'yes') { setCookie('ciNav', 'yes', 365); + } else { + setCookie('ciNav', 'no', 365); + } + tocFlip(); + }); + var tocFlip = function(){ + if (getCookie('ciNav') == 'yes') { $('#nav2').show(); $('#topMenu').remove(); - $('body').css({background: 'none'}); - $('.wy-nav-content-wrap').css({background: 'none', 'margin-left': 0}); + $('body').css({ background: 'none' }); + $('.wy-nav-content-wrap').css({ background: 'none', 'margin-left': 0 }); $('.wy-breadcrumbs').append('
' + $('.wy-form').parent().html() + '
'); $('.wy-nav-side').toggle(); - }, - function () - { - setCookie('ciNav', 'no', 365); + } else { $('#topMenu').remove(); $('#nav').hide(); $('#nav2').hide(); - $('body').css({background: '#edf0f2;'}); - $('.wy-nav-content-wrap').css({background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px'}); + $('body').css({ background: '#edf0f2;' }); + $('.wy-nav-content-wrap').css({ background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px' }); $('.wy-nav-side').show(); } - ); + }; if (getCookie('ciNav') == 'yes') { - $('#closeMe').trigger('click'); + tocFlip(); //$('#nav').slideToggle(); } // END MODIFICATION --- -- cgit v1.2.3-24-g4f1b