Static table of contents (#701)

* Add showing/hiding submenus, fix sidebar styling, fix bug where includes wouldn't appear in ToC

* Update ToC to highlight last header if page is scrolled to very bottom, fixes #280

* Set HTML title to current h1 section text, see #133

* Fix menu not opening on mobile

* Add back increase toc item height on mobile

* Fix padding bug

* Add back in ToC sliding animation
This commit is contained in:
Robert Lord
2017-02-24 11:57:39 -06:00
committed by GitHub
parent e7f5144e4c
commit 53e2f23e5c
13 changed files with 203 additions and 1698 deletions

View File

@@ -15,13 +15,14 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
(function (global) {
;(function () {
'use strict';
var languages = [];
global.setupLanguages = setupLanguages;
global.activateLanguage = activateLanguage;
window.setupLanguages = setupLanguages;
window.activateLanguage = activateLanguage;
window.getLanguageFromQueryString = getLanguageFromQueryString;
function activateLanguage(language) {
if (!language) return;
@@ -36,7 +37,7 @@ under the License.
$(".highlight.tab-" + language).show();
$(".lang-specific." + language).show();
global.toc.calculateHeights();
window.recacheHeights();
// scroll to the new location of the position
if ($(window.location.hash).get(0)) {
@@ -159,8 +160,5 @@ under the License.
activateLanguage(language);
return false;
});
window.onpopstate = function() {
activateLanguage(getLanguageFromQueryString());
};
});
})(window);
})();