pages/assets/js
Julian Wiest 729f136fb0
Add offset option to scrollspy initialization (#3354)
## Fix ToC Scroll-Spy Highlighting Issue

### Problem
When clicking on a ToC link in the sidebar, the page scrolls to the
correct section, but the ToC highlights the *previous* section instead
of the current one. The correct section only gets highlighted after
scrolling down a few pixels.

### Root Cause
The `scrollspy` in `assets/js/common.js` was initialized without an
offset parameter, so it didn't account for the fixed navigation header
height (~56px).

### Solution
Added `offset: 100` parameter to the scrollspy initialization to
properly detect when a section becomes visible, accounting for the
header and some buffer space.

### Changes
- Modified `assets/js/common.js`: Added offset parameter to scrollspy
configuration

### Testing
- [x] ToC correctly highlights the current section immediately after
clicking
- [x] Headings remain visible (not hidden under header)
- [x] Smooth scrolling works as expected

---------

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>
2025-11-07 12:15:08 -08:00
..
distillpub Add sidenote examples, related posts and giscus to distill posts (#3103) 2025-07-16 15:07:42 -03:00
search Fixed bug when search result is inside description of external post (#2710) 2024-09-20 19:04:17 -03:00
bibsearch.js Fixed error in bibsearch.js 2024-07-13 14:05:20 -03:00
bootstrap-toc.min.js Fix prettier (#2062) 2024-01-10 11:21:58 -03:00
bootstrap.bundle.min.js Fix prettier (#2062) 2024-01-10 11:21:58 -03:00
bootstrap.bundle.min.js.map Added support to PurgeCSS (#1562) 2023-09-28 14:22:42 -03:00
chartjs-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
common.js Add offset option to scrollspy initialization (#3354) 2025-11-07 12:15:08 -08:00
copy_code.js Added support for plotly js (#3097) 2025-03-26 17:16:03 -03:00
diff2html-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
echarts-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
highlight-search-term.js feat: simple filtering / searching on bibliography (#2523) 2024-07-08 16:51:22 -03:00
jupyter_new_tab.js Add functionality to open external links in jupyter notebooks in new tab (#2233) 2024-02-27 12:25:16 -03:00
leaflet-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
masonry.js format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
mathjax-setup.js Fix issue causing no color inversion when rendering equations (#2956) 2025-01-15 23:11:44 -03:00
mermaid-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
newsletter.js Added missing newsletter components (#2913) 2024-12-26 16:49:45 -03:00
no_defer.js Remove bootstrap-table from archive tables (#2306) 2024-04-03 15:35:18 -03:00
plotly-setup.js Added support for plotly js (#3097) 2025-03-26 17:16:03 -03:00
progress-bar.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
pseudocode-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
search-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
shortcut-key.js Fix code blocks not changing to plots and others (#2497) 2024-06-11 14:06:38 -03:00
tabs.min.js Added support for jekyll-tabs (#2380) 2024-05-02 14:34:48 -03:00
theme.js Added support for plotly js (#3097) 2025-03-26 17:16:03 -03:00
tooltips-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
typograms.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
vanilla-back-to-top.min.js Fix: Add back-to-top button (#2433) 2024-05-24 15:58:55 -03:00
vega-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
venobox-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
wechat.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
zoom.js format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00