Skip to content

Commit

Permalink
src : add callback to .remove()
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Feb 10, 2012
1 parent faf0ce8 commit 0b0cdcc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion _posts/docs/2010-12-04-methods.mdown
Expand Up @@ -130,7 +130,7 @@ Re-collects all item elements in their current order in the DOM. Useful for pre

{% highlight javascript %}

.isotope( 'remove', $items )
.isotope( 'remove', $items, callback )

{% endhighlight %}

Expand Down
11 changes: 7 additions & 4 deletions jquery.isotope.js
@@ -1,12 +1,12 @@
/**
* Isotope v1.5.10
* Isotope v1.5.11
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time license fee
* http://metafizzy.co/#licenses
*
* Copyright 2011 David DeSandro / Metafizzy
* Copyright 2012 David DeSandro / Metafizzy
*/

/*jshint curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, undef: true */
Expand Down Expand Up @@ -797,7 +797,7 @@
},

// removes elements from Isotope widget
remove: function( $content ) {
remove: function( $content, callback ) {
// remove elements from Isotope instance in callback
var instance = this;
var removeContent = function() {
Expand All @@ -810,10 +810,13 @@
this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
this.$filteredAtoms = this.$filteredAtoms.not( $content );
this._sort();
this.reLayout( removeContent );
this.reLayout( removeContent, callback );
} else {
// remove it now
removeContent();
if ( callback ) {
callback.call( this.element );
}
}

},
Expand Down

0 comments on commit 0b0cdcc

Please sign in to comment.