Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using JavaScript method duplicates TOC #21

Closed
mtaanquist opened this issue May 15, 2016 · 1 comment
Closed

Using JavaScript method duplicates TOC #21

mtaanquist opened this issue May 15, 2016 · 1 comment
Labels

Comments

@mtaanquist
Copy link

As per subject. Using the JavaScript method would have it duplicate the TOC generated, which seemingly seems to be caused by the following code in bootstrap-toc.js:

$(function() { $('nav[data-toggle="toc"]').each(function(i, el) { var $nav = $(el); Toc.init($nav); }); });

At the end of the file. It seems it adds the data-toggle to the element you choose in the function just above, and then this initialises the TOC again. Commenting it out fixed the issue for me.

@afeld afeld added the question label Jun 29, 2016
@afeld
Copy link
Owner

afeld commented Jun 29, 2016

So sorry for not getting back to you sooner. You need to make sure you don't have the data-toggle="toc" attribute if you are initializing the plugin via JavaScript. I made the example more clear in d08947a. Feel free to re-open if that doesn't solve your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants