MarionetteJS extension to decorate a CollectionView with callbacks to allow animated DOM insertion and removal.
var decorateAnimatedCollectionView = require('Marionette.AnimatedCollectionView');
var ListView = Marionette.CollectionView.extend({
// …
});
var AnimatedListView = decorateAnimatedCollectionView(ListView, {
// CSS class name to add for animating DOM insertion
add: 'item-adding',
// CSS class name to add for animating DOM removal
remove: 'item-removing',
// delay in milliseconds to wait in between animating mutliple items of a collection
// animate element 1, wait, animate element 2, wait, …
stagger: 100,
// automatic promise resolution
promise: {
// options from jQuery-transitionEndEvent
resolveTimeout: 1000
}
});
- documentation and tests
- API to differentiate between initial render and later additions
- API for animated sorting
# with bower
bower install Marionette.AnimatedCollectionView
# with npm
npm install marionette.animatedcollectionview
Note: requires 'jQuery-transitionEndPromise' to be made available at jQuery-transitionEndPromise
Marionette.AnimatedCollectionView is published under the MIT License.
- renaming drag option to stagger option - I clearly have no idea what I'm doing.
- adding drag option
- fixing bad options access
- … still too dumb for package managers…
- Of course I'm too dumb for package managers…
- Initial Version