You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this Table of Contents in a dropdown and I want to use scrollspy() to keep track of where I am in the document. I often have hundreds of pages so a dropdown with and `overflow-y: auto;`` makes some design sense at this point. However, I also would like to do some other things when the page changes. Notably Change Page # on the dropdown button to the actual page. According to the documentation I would use something like the following:
$('#myScrollspy').on('activate.bs.scrollspy', function () {
// do something…
});
Thanks for taking a look, I meant to update this the other day. Because my solution was different.
Funny you notice the trigger('activate') in the js. Because that is exactly what I saw first when digging in the source. But, just using .on('activate') does not work. (see: http://jsfiddle.net/2W8AC/1/), in fact, you can get.on(activate.bs.scrollspy)` working using the demo markup from the docs => http://jsfiddle.net/qw36f/
It turned out my problem was related to my markup. If you notice at line 110 in scrollspy.js or about 1699 in dist the following portion:
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
I was missing <li class="dropdown">. once the class was added everything seemed to work just fine.
see => http://jsfiddle.net/Mt25g/2/
there was some discussion about this as well in IRC too.
Would it be possible to get the dropdown menu to show which section currently being viewed? For example, when the section "Sauges" is focused the dropdown menu itself should indicate this.
I have this Table of Contents in a dropdown and I want to use scrollspy() to keep track of where I am in the document. I often have hundreds of pages so a dropdown with and `overflow-y: auto;`` makes some design sense at this point. However, I also would like to do some other things when the page changes. Notably Change Page # on the dropdown button to the actual page. According to the documentation I would use something like the following:
however, this fails to work. see the following fiddle: http://jsfiddle.net/2W8AC/
The text was updated successfully, but these errors were encountered: