twitter/bootstrap — pull request #6247 by jimwebb (2012-12-12 17:03:02+00:00)
Title: change scrollspy documentation to clarify javascript usage

The scrollspy documentation suggests calling a scrollspy instance in JavaScript with the following code:

$('#navbar').scrollspy();

This is wrong unless #navbar is what's scrolling. Scrollspy is invoked on what's being spied, not on the target. What I think the author means to say is:

$('body').scrollspy({ target: '#navbar' });

I've changed the documentation to reflect this, and to state that the scrollspy script is specifically looking for .nav li > a, which may be confusing for folks who tweak the standard nav component.

Mentioned in this bug:
https://github.com/twitter/bootstrap/issues/5553

This is my first pull request; holler (nicely, please) if I've done something incorrectly.