<commit_before>{{>getting-started}}

<h2>Using the ScrollSpy plugin</h2>

<p>Use Affix by plugging it into the node whose scroll state you want to spy on. This is usually the page's body. Pass it a configuration object with a <code>target</code> attribute. The <code>target</code> attribute should be a CSS selector string or a Node that points to a list that contains links to elements in the page. These links must be hash URLs with a value equal to the element's ID.</p>

```javascript
YUI({
    gallery: '{{gallery-build}}'
}).use('gallery-scrollspy', function (Y) {

    Y.one('body').plug(Y.Plugin.ScrollSpy, {
        target: '#navbar'
    });

});
```

<p>Alternatively you can set the target as a <code>data-</code> attribute of the plugged node.</p>

```html
<body data-target="navbar">...</body>
```

<h2>Example</h2>

<p>The left navigation of this document page is a working example of the ScrollSpy plugin.</p>

<h2>Release notes</h2>
<commit_msg>Shorter heading<commit_after>{{>getting-started}}

<h2>Using ScrollSpy</h2>

<p>Use Affix by plugging it into the node whose scroll state you want to spy on. This is usually the page's body. Pass it a configuration object with a <code>target</code> attribute. The <code>target</code> attribute should be a CSS selector string or a Node that points to a list that contains links to elements in the page. These links must be hash URLs with a value equal to the element's ID.</p>

```javascript
YUI({
    gallery: '{{gallery-build}}'
}).use('gallery-scrollspy', function (Y) {

    Y.one('body').plug(Y.Plugin.ScrollSpy, {
        target: '#navbar'
    });

});
```

<p>Alternatively you can set the target as a <code>data-</code> attribute of the plugged node.</p>

```html
<body data-target="navbar">...</body>
```

<h2>Example</h2>

<p>The left navigation of this document page is a working example of the ScrollSpy plugin.</p>

<h2>Release notes</h2>

{'fraction_non_alphanumeric': 0.1359121798222687, 'fraction_numerical': 0.006272869837950863, 'mean_word_length': 4.145161290322581, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4850049', 'n_tokens_mistral': 624, 'n_tokens_neox': 583, 'n_words': 239}