Fix TOC width issue
This commit is contained in:
		
							parent
							
								
									b27ddd1e7f
								
							
						
					
					
						commit
						bdb08dd14b
					
				|  | @ -74,11 +74,13 @@ | |||
|         // TOC | ||||
|         const FUDGE = 100; | ||||
|         const TOC_TOP_SPACING = 20; | ||||
|         document.addEventListener('scroll', () => { | ||||
|         function updateTOC() { | ||||
|             // Stickiness | ||||
|             const sidebarWidth = sidebar.clientWidth; | ||||
|             const stick = window.pageYOffset > sidebar.offsetTop-TOC_TOP_SPACING; | ||||
|             tocContainer.style.position = stick ? 'fixed' : 'static'; | ||||
|             tocContainer.style.top = `${TOC_TOP_SPACING}px`; | ||||
|             tocContainer.style.width = `${sidebarWidth}px`; | ||||
| 
 | ||||
|             // Active items | ||||
|             let activeEntry = null; | ||||
|  | @ -95,7 +97,9 @@ | |||
|             if (activeEntry) { | ||||
|                 activeEntry.link.classList.add('active'); | ||||
|             } | ||||
|         }); | ||||
|         } | ||||
|         document.addEventListener('scroll', updateTOC); | ||||
|         window.addEventListener('resize', updateTOC); | ||||
| 
 | ||||
|         // Notes | ||||
|         function toggleNotes() { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue