Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kanety/jquery-simple-toggle


https://github.com/kanety/jquery-simple-toggle

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

        

# jquery-simple-toggle

A jquery plugin for simple togglable panels.

## Dependencies

* jquery

## Installation

Install from npm:

$ npm install @kanety/jquery-simple-toggle --save

## Usage

Build html as follows:

```html


menu1
menu2
menu3


panel1

panel2

panel3


```

Then run:

```javascript
$('#menu').simpleToggle({
panelContainer: '#panel'
});
```

### Options

Change selector for menus and paneles:

```javascript
$('#menu').simpleToggle({
...
menu: '[href]',
menuAttr: 'href'
panel: '[name]',
panelAttr: 'name'
});
```

Store current panel in the web storage:

```javascript
$('#menu').simpleToggle({
...
store: 'session',
storeKey: 'YOUR_STORAGE_KEY'
});
```

### Callbacks

```javascript
$('#menu').simpleToggle({
...
}).on('panel:show', function(e, $panel) {
...
}).on('panel:hide', function(e, $panel) {
...
});
```

## License

The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).