Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jhammann/jquery-navscroll

📜 A simple jQuery plugin for animated scrolling to a section of your page, with scrollspy and mobile dropdown support.
https://github.com/jhammann/jquery-navscroll

animated javascript jquery navigation scroll scrollspy

Last synced: 3 days ago
JSON representation

📜 A simple jQuery plugin for animated scrolling to a section of your page, with scrollspy and mobile dropdown support.

Awesome Lists containing this project

README

        

# NavScroll

NavScroll is a simple jQuery plugin for animated scrolling to a section of your page. It also features mobile dropdown support so if your navigation transforms into a dropdown on a certain breakpoint, navScroll hides the dropdown after a click.

## Demo

There's a demo included with this package. It's an example of navigation I use a lot, so feel free to use it yourself!

You can also checkout the demo here: [jhammann.github.io/jquery-navScroll/demo/](http://jhammann.github.io/jquery-navScroll/demo/)

## Setup

Include a recent version of jQuery and the navScroll plugin inside your page.

```html

// To attach navScroll to an element without mobile dropdown support
$('.nav').navScroll();

// Or you can enable mobile dropdown support and give it a custom breakpoint (defaults to 1024)
$('.nav').navScroll({
mobileDropdown: true,
mobileBreakpoint: 768
});

```

#### Install
You can install jquery-navScroll with NPM:

```shell
npm install jquery-nav-scroll -S
```

You can also use a CDN:

```
https://unpkg.com/jquery-nav-scroll/jquery.navScroll.min.js
```

## Options

| Name | Description | Type | Default |
|------|-------------|------|---------|
| `scrollTime` | The time it takes to scroll to the element in milliseconds (set this to 0 so it obviously won't show an animation). | Integer | 500 |
| `navItemClassName` | The class of the items which invokes the scroll animation. All anchor tags inside the element are clickable when the value is empty. | String | '' |
| `navHeight` | Set the height of the navigation (to use as offset). 'auto' let's the plugin determine the height automatically, a number determines the height in px. | Integer or String | 'auto' |
| `mobileDropdown` | If your navigation hides and is used as a dropdown on small screens setting this to true hides the dropdown after a click. | Boolean | false |
| `mobileDropdownClassName` | Additionaly you can insert the mobile nav's classname here, when left empty the plugin searches for a `