mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-09 16:50:23 -06:00
docs: Have menuspy recalculate positions after all images have been loaded Fixes #99
This commit is contained in:
11
docs/themes/cypress/source/js/toc.js
vendored
11
docs/themes/cypress/source/js/toc.js
vendored
@@ -9,10 +9,17 @@
|
||||
|
||||
if (!toc) return;
|
||||
|
||||
// https://github.com/lcdsantos/menuspy
|
||||
// This highlights the proper toc link while scrolling
|
||||
var ms = new MenuSpy(tocInner)
|
||||
|
||||
// we need this to be called after all images have loaded
|
||||
// otherwise the height for the menuspy is not properly calculated
|
||||
window.addEventListener('load', function(){
|
||||
// https://github.com/lcdsantos/menuspy
|
||||
// This highlights the proper toc link while scrolling
|
||||
ms.cacheItems()
|
||||
ms.tick()
|
||||
});
|
||||
|
||||
// This keeps the toc within the view
|
||||
function updateSidebarPosition(){
|
||||
var scrollTop = document.scrollingElement.scrollTop;
|
||||
|
||||
Reference in New Issue
Block a user