gfranko / jquery.tocify.js

A jQuery Table of Contents plugin that can be themed with Twitter Bootstrap or jQueryUI.
http://gregfranko.com/jquery.tocify.js/
MIT License
927 stars 217 forks source link

Error when higher level selector does not exist #31

Closed ViktorQvarfordt closed 11 years ago

ViktorQvarfordt commented 11 years ago

Maybe its not considered semantically meaningful to have something like the following

<h1>Level 1 header</h1>
<h3>Level 3 header</h3>

But tocify fails with error

Uncaught TypeError: Cannot read property 'top' of undefined, jquery.tocify.js:564

See this demonstration.

gfranko commented 11 years ago

Your example only included the h3 header. In the latest release, I make sure an error is not thrown when there is only one selector used.