You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

theme.js 948 B

9 years ago
1234567891011121314151617181920212223242526272829303132
  1. $( document ).ready(function() {
  2. // Shift nav in mobile when clicking the menu.
  3. $(document).on('click', "[data-toggle='nav-top']", function() {
  4. $("[data-toggle='nav-shift']").toggleClass("shift");
  5. });
  6. // Close menu when you click a link.
  7. $(document).on('click', ".menu-vertical .current ul li a", function() {
  8. $("[data-toggle='nav-shift']").removeClass("shift");
  9. });
  10. // Make tables responsive
  11. $("table.docutils:not(.field-list)").wrap("<div class='table-responsive'></div>");
  12. $('table').addClass('docutils');
  13. var currentEntry = $('li.tocentry.current');
  14. if(!(currentEntry===undefined))
  15. {
  16. var offset = currentEntry.offset();
  17. if(!(offset===undefined))
  18. {
  19. if(offset.top + 40 > window.innerHeight)
  20. {
  21. // scroll current selected to top.
  22. $('.nav-side').scrollTop(currentEntry.offset().top - ($('.nav-side').offset().top + 80));
  23. }
  24. }
  25. }
  26. hljs.initHighlightingOnLoad();
  27. });