From ecfa09decb7dff6ad601834c2ad400467a72ba96 Mon Sep 17 00:00:00 2001 From: Jim Webb Date: Wed, 12 Dec 2012 11:48:44 -0500 Subject: [PATCH] * modify scrollspy documentation to clarify javascript usage * add scrollspy 'target' option --- docs/javascript.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 6c4fbf7fbb..418dec9e61 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -571,12 +571,12 @@ $('#myModal').on('hidden', function () {

Usage

Via data attributes

-

To easily add scrollspy behavior to your topbar navigation, just add data-spy="scroll" to the element you want to spy on (most typically this would be the body) and data-target=".navbar" to select which nav to use. You'll want to use scrollspy with a .nav component.

+

To easily add scrollspy behavior to your topbar navigation, just add data-spy="scroll" to the element you want to spy on (most typically this would be the body) and data-target=".navbar" to select which nav to use. You'll need to use scrollspy with a .nav component.

<body data-spy="scroll" data-target=".navbar">...</body>

Via JavaScript

Call the scrollspy via JavaScript:

-
$('#navbar').scrollspy()
+
$('body').scrollspy(options)
Heads up! @@ -604,6 +604,12 @@ $('[data-spy="scroll"]').each(function () { + + target + selector + 'body' + Nav target to be updated on scroll. (Scrollspy looks for .nav li > a inside this target.) + offset number