Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanety/jquery-simple-toggle
https://github.com/kanety/jquery-simple-toggle
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kanety/jquery-simple-toggle
- Owner: kanety
- License: mit
- Created: 2019-06-16T04:40:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-18T08:56:17.000Z (over 5 years ago)
- Last Synced: 2024-12-25T04:04:43.967Z (23 days ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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
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).