Permalink
Browse files

src & docs : add instance argument for onLayout callback

v1.5.18
  • Loading branch information...
1 parent ac26181 commit d091835092106bbc3e6b4bce2defb1dd171f81da @desandro desandro committed Mar 27, 2012
Showing with 10 additions and 7 deletions.
  1. +3 −1 _posts/docs/2010-12-03-options.mdown
  2. +3 −2 _posts/tests/2012-02-07-onlayout.html
  3. +2 −2 jquery.isotope.js
  4. +2 −2 jquery.isotope.min.js
@@ -234,11 +234,13 @@ Similiar to a callback, `onLayout` is a function that will be triggered after ev
{% highlight javascript %}
$('#container').isotope({
- onLayout: function( $elems ) {
+ onLayout: function( $elems, instance ) {
// `this` refers to jQuery object of the container element
console.log( this.height() );
// callback provides jQuery object of laid-out item elements
$elems.css({ background: 'blue' });
+ // instance is the Isotope instance
+ console.log( instance.$filteredAtoms.length );
}
});
@@ -5,7 +5,7 @@
---
<section id="copy">
- <p>Tests that onLayout callback is triggering properly, after animation/transition has completed.</p>
+ <p>Tests that <a href="../docs/options.html#onlayout">onLayout callback</a> is triggering properly, after animation/transition has completed.</p>
</section>
@@ -48,10 +48,11 @@ <h3>Etc</h3>
var colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'white'],
colorI = 0;
- function changeBGColor() {
+ function changeBGColor( $elems, instance ) {
var color = colors[ colorI % colors.length ];
$container.css({ background: color })
colorI++;
+ // console.log( $elems.length, instance.$filteredAtoms.length );
}
function lmk() {
View
@@ -1,5 +1,5 @@
/**
- * Isotope v1.5.17
+ * Isotope v1.5.18
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
@@ -664,7 +664,7 @@
for (var i=0, len = callbacks.length; i < len; i++) {
hollaback = callbacks[i];
if ( typeof hollaback === 'function' ) {
- hollaback.call( instance.element, $elems );
+ hollaback.call( instance.element, $elems, instance );
}
}
isCallbackTriggered = true;
View

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit d091835

Please sign in to comment.