jim | 7efcd70 | 2015-02-04 14:23:33 -0800 | [diff] [blame] | 1 | $( document ).ready(function() { |
| 2 | // Shift nav in mobile when clicking the menu. |
| 3 | $(document).on('click', "[data-toggle='wy-nav-top']", function() { |
| 4 | $("[data-toggle='wy-nav-shift']").toggleClass("shift"); |
| 5 | $("[data-toggle='rst-versions']").toggleClass("shift"); |
| 6 | }); |
| 7 | // Close menu when you click a link. |
| 8 | $(document).on('click', ".wy-menu-vertical .current ul li a", function() { |
| 9 | $("[data-toggle='wy-nav-shift']").removeClass("shift"); |
| 10 | $("[data-toggle='rst-versions']").toggleClass("shift"); |
| 11 | }); |
| 12 | $(document).on('click', "[data-toggle='rst-current-version']", function() { |
| 13 | $("[data-toggle='rst-versions']").toggleClass("shift-up"); |
| 14 | }); |
| 15 | // Make tables responsive |
| 16 | $("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>"); |
| 17 | }); |
| 18 | |
| 19 | window.SphinxRtdTheme = (function (jquery) { |
| 20 | var stickyNav = (function () { |
| 21 | var navBar, |
| 22 | win, |
| 23 | stickyNavCssClass = 'stickynav', |
| 24 | applyStickNav = function () { |
| 25 | if (navBar.height() <= win.height()) { |
| 26 | navBar.addClass(stickyNavCssClass); |
| 27 | } else { |
| 28 | navBar.removeClass(stickyNavCssClass); |
| 29 | } |
| 30 | }, |
| 31 | enable = function () { |
| 32 | applyStickNav(); |
| 33 | win.on('resize', applyStickNav); |
| 34 | }, |
| 35 | init = function () { |
| 36 | navBar = jquery('nav.wy-nav-side:first'); |
| 37 | win = jquery(window); |
| 38 | }; |
| 39 | jquery(init); |
| 40 | return { |
| 41 | enable : enable |
| 42 | }; |
| 43 | }()); |
| 44 | return { |
| 45 | StickyNav : stickyNav |
| 46 | }; |
| 47 | }($)); |