aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Webb <[email protected]>2012-12-12 11:48:44 -0500
committerJim Webb <[email protected]>2012-12-12 11:48:44 -0500
commitecfa09decb7dff6ad601834c2ad400467a72ba96 (patch)
treef3970eafc1e9aa1532faa5d66b921ed0219391dd
parentbc0b94a3fdc8fe480c74f4494073e2c0addb265e (diff)
downloadbootstrap-ecfa09decb7dff6ad601834c2ad400467a72ba96.tar.xz
bootstrap-ecfa09decb7dff6ad601834c2ad400467a72ba96.zip
* modify scrollspy documentation to clarify javascript usage
* add scrollspy 'target' option
-rw-r--r--docs/javascript.html10
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/javascript.html b/docs/javascript.html
index 6c4fbf7fb..418dec9e6 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -571,12 +571,12 @@ $('#myModal').on('hidden', function () {
<h2>Usage</h2>
<h3>Via data attributes</h3>
- <p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body) and <code>data-target=".navbar"</code> to select which nav to use. You'll want to use scrollspy with a <code>.nav</code> component.</p>
+ <p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body) and <code>data-target=".navbar"</code> to select which nav to use. You'll need to use scrollspy with a <code>.nav</code> component.</p>
<pre class="prettyprint linenums">&lt;body data-spy="scroll" data-target=".navbar"&gt;...&lt;/body&gt;</pre>
<h3>Via JavaScript</h3>
<p>Call the scrollspy via JavaScript:</p>
- <pre class="prettyprint linenums">$('#navbar').scrollspy()</pre>
+ <pre class="prettyprint linenums">$('body').scrollspy(options)</pre>
<div class="alert alert-info">
<strong>Heads up!</strong>
@@ -605,6 +605,12 @@ $('[data-spy="scroll"]').each(function () {
</thead>
<tbody>
<tr>
+ <td>target</td>
+ <td>selector</td>
+ <td>'body'</td>
+ <td>Nav target to be updated on scroll. (Scrollspy looks for <code>.nav li > a</code> inside this target.)</td>
+ </tr>
+ <tr>
<td>offset</td>
<td>number</td>
<td>10</td>