Echo for web ui.
$ spm install echo
var Echo = require('echo');
var echo = new Echo("#echo-container > .echo-item", {
min: 1,
max: 5
});
$("#btn-echo").click(function(){
echo.echo();
});
constructor.
params:
- elements, [required], support following types.
- {String} selector.
- {HTMLElement} element.
- {jQuery} jQuery element.
- options, [optional]
min
: {Number}, default:0
.max
: {Number}, default:Number.MAX_VALUE
.template
: support following types.- {String}: template string, or selector.
- {Function} return template string or selector.
Append an echo element item at the end.
Add or insert an echo element item at index.
Insert an echo element item before item.
Append an echo element item after item.
Remove an echo element item.
Remove an echo element at index.
eg.
echo.move(item, 1); // move item down 1 row.
echo.move(item, -1); // move item up 1 row.
eg.
echo.moveTo(item, 1); // move item to row index 1.
echo.moveTo(item, -1); // move item to the bottom row.
Clear all of echo elements.
Render Echo.
Add event listener.
Remove event listener.
When echo elements length less than or equal the min length, fire min
event.
When before echo a new elements, echo elements length equal the min length,
after echo new elements finished, fire unmin
event.
When echo elements length great than or equal the min length, fire max
event.
When before remove a echo elements, echo elements length equal the max length,
after remove echo element item finished, fire unmax
event.
When echo a copy element, fire echo
event.
When remove an echo element, fire remove
event.
When top echo item moved, fire move
event.
When echo item changed to the top, fire top
event.
When top echo item changed from top to other position, fire untop
event.
When echo item changed to bottom, fire bottom
event.
When echo item changed from bottom to other position, fire unbottom
event.