bootstrap-toc icon indicating copy to clipboard operation
bootstrap-toc copied to clipboard

If header starts with a number, scrollspy not works

Open slamslam612 opened this issue 5 years ago • 2 comments

If header starts with a number, script creates an id with a number at the beginning, which is wrong. In html id can't start with a number. It would also be nice to strip all html entities (e.g. &) from id.

slamslam612 avatar Nov 07 '19 09:11 slamslam612

I just noticed this as well.

For some reason this was ok: <h2 id="2016aidsheader" class="pt-5">2016 AIDS Conference</h2>

But this, nested within another h2 was not:

<h3>508 Memorial</h3>

¯_(ツ)_/¯

slambert avatar Jan 06 '20 04:01 slambert

I might be experiencing something similar as scrollspy does not pass the sections with parenthesis on page https://bioworkflows.com/ictr/COVID19-outbreak-simulator-model/2 .

Edit: I think I encountered the same problem with this stackoverflow post. The problem is that the IDs are generated by bootstrap-toc, not by me, so it should perhaps remove ( and ) in the first place.

Edit: It turns out that the document came with IDs that contains ( and ), in which case bootstrap-toc will simply use existing IDs. I think what bootstrap-toc is doing is correct because the IDs might be used by the document, but scrollspy does fail to work because of this. I have tried to fix it by adjusting the ID in the document.

BoPeng avatar Apr 11 '20 21:04 BoPeng