<commit_before># MenuSpy

A JavaScript library to make navigation menus highlight active item based on the scroll position.

* Features
* Usage
* Options
* Examples

## Usage

Include MenuSpy

```html
<script src="menuspy.js"></script>
```

`MenuSpy` will be available in the global scope.

Or install with NPM and require as a module

```
npm install menuspy
```

```js
var MenuSpy = require('menuspy');
```

Initialize the plugin on your menu element

```html
<header id="main-header">
  <nav>
    <ul>
      <li><a href="#features">Features</a></li>
      <li><a href="#usage">Usage</a></li>
      <li><a href="#options">Options</a></li>
      <li><a href="#examples">Examples</a></li>
    </ul>
  </nav>
</header>
```

```js
var elm = document.querySelector('#main-header');
var ms = new MenuSpy(elm);
```

The `MenuSpy()` constructor accepts two arguments: the container element and an options object.


## Options

| Option             | Type     | Default                             | Description                                                              |
| ------------------ | -------- | ----------------------------------- | ------------------------------------------------------------------------ |
| `menuItemSelector` | String   | `a[href^="#"]`                      | Menu items selector.                                                     |
| `menuItemSelector` | String   | `active`                            | Class applied on menu item relative to the currently visible section.    |
| `threshold`        | Integer  | `15`                                | Ammount of space between your menu and the next section to be activated. |
| `hashTimeout`      | Integer  | `600`                               | Timeout to apply browser's hash location.                                |
| `callback`         | Function | `function(anchorElm, targetElm) {}` | A function to be called every time a new menu item activates.            |<commit_msg>Fixed readme<commit_after># MenuSpy

A JavaScript library to make navigation menus highlight active item based on the scroll position.

* No dependencies
* Easy to use
* Lightweight and fast

## Usage

Include MenuSpy

```html
<script src="menuspy.js"></script>
```

`MenuSpy` will be available in the global scope.

Or install with NPM and require as a module

```
npm install menuspy
```

```js
var MenuSpy = require('menuspy');
```

Initialize the plugin on your menu element

```html
<header id="main-header">
  <nav>
    <ul>
      <li><a href="#features">Features</a></li>
      <li><a href="#usage">Usage</a></li>
      <li><a href="#options">Options</a></li>
      <li><a href="#examples">Examples</a></li>
    </ul>
  </nav>
</header>
```

```js
var elm = document.querySelector('#main-header');
var ms = new MenuSpy(elm);
```

The `MenuSpy()` constructor accepts two arguments: the container element and an options object.


## Options

| Option             | Type     | Default                             | Description                                                              |
| ------------------ | -------- | ----------------------------------- | ------------------------------------------------------------------------ |
| `menuItemSelector` | String   | `a[href^="#"]`                      | Menu items selector.                                                     |
| `menuItemSelector` | String   | `active`                            | Class applied on menu item relative to the currently visible section.    |
| `threshold`        | Integer  | `15`                                | Ammount of space between your menu and the next section to be activated. |
| `hashTimeout`      | Integer  | `600`                               | Timeout to apply browser's hash location.                                |
| `callback`         | Function | `function(anchorElm, targetElm) {}` | A function to be called every time a new menu item activates.            |
{'fraction_non_alphanumeric': 0.18318089430894308, 'fraction_numerical': 0.002540650406504065, 'mean_word_length': 1.5782580222658809, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4274630', 'n_tokens_mistral': 1011, 'n_tokens_neox': 960, 'n_words': 327}