https://github.com/bredele/jquery-stack
Jquery plugin to stack your dom nodes
https://github.com/bredele/jquery-stack
Last synced: over 1 year ago
JSON representation
Jquery plugin to stack your dom nodes
- Host: GitHub
- URL: https://github.com/bredele/jquery-stack
- Owner: bredele
- Created: 2013-10-16T14:40:46.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-16T16:16:16.000Z (almost 13 years ago)
- Last Synced: 2025-03-27T01:35:25.590Z (over 1 year ago)
- Language: JavaScript
- Size: 430 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# jquery-stack
jQuery plugin to stack your dom nodes
## Usage
First, include the jQuery and the stack plugin:
```html
```
Then create your stack as following (a stack can be any content):
```html
child1
child2
child3
```
and intialize your plugin:
```js
var stack = $('.stack').stack({
default:'child1'
});
```
## API
### add(name, dom)
Identify a jquery element by name and push it into the stack
```js
stack.add('child4', $('.child4'));
```
### show(name)
Display a stacked element into the `parent` element.
```js
stack.show('child3');
```
## Events
### show
```js
$('.stack').trigger('show', 'child2');
```
## Options
### Namespace
By default, the plugin look for nodes containing the `stack` data-attribute . You can set this namespace with the following option:
```js
var stack = $('.stack').stack({
namespace:'obama'
});
```
### Default visible
When you create a stack, every child nodes are stacked into a document fragment and are not visible on the screen. However, you can choose to display one by default:
```js
var stack = $('.stack').stack({
default:'child2'
});
```
## Component
You can install a component version with [component(1)](http://component.io):
$ component install bredele/stack
## License
MIT