Browse Source

src & docs : add instance argument for onLayout callback

v1.5.18
pull/183/head
David DeSandro 13 years ago
parent
commit
d091835092
  1. 4
      _posts/docs/2010-12-03-options.mdown
  2. 5
      _posts/tests/2012-02-07-onlayout.html
  3. 4
      jquery.isotope.js
  4. 4
      jquery.isotope.min.js

4
_posts/docs/2010-12-03-options.mdown

@ -234,11 +234,13 @@ Similiar to a callback, `onLayout` is a function that will be triggered after ev
{% highlight javascript %} {% highlight javascript %}
$('#container').isotope({ $('#container').isotope({
onLayout: function( $elems ) { onLayout: function( $elems, instance ) {
// `this` refers to jQuery object of the container element // `this` refers to jQuery object of the container element
console.log( this.height() ); console.log( this.height() );
// callback provides jQuery object of laid-out item elements // callback provides jQuery object of laid-out item elements
$elems.css({ background: 'blue' }); $elems.css({ background: 'blue' });
// instance is the Isotope instance
console.log( instance.$filteredAtoms.length );
} }
}); });

5
_posts/tests/2012-02-07-onlayout.html

@ -5,7 +5,7 @@ category: tests
--- ---
<section id="copy"> <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> </section>
@ -48,10 +48,11 @@ category: tests
var colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'white'], var colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'white'],
colorI = 0; colorI = 0;
function changeBGColor() { function changeBGColor( $elems, instance ) {
var color = colors[ colorI % colors.length ]; var color = colors[ colorI % colors.length ];
$container.css({ background: color }) $container.css({ background: color })
colorI++; colorI++;
// console.log( $elems.length, instance.$filteredAtoms.length );
} }
function lmk() { function lmk() {

4
jquery.isotope.js

@ -1,5 +1,5 @@
/** /**
* Isotope v1.5.17 * Isotope v1.5.18
* An exquisite jQuery plugin for magical layouts * An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co * http://isotope.metafizzy.co
* *
@ -664,7 +664,7 @@
for (var i=0, len = callbacks.length; i < len; i++) { for (var i=0, len = callbacks.length; i < len; i++) {
hollaback = callbacks[i]; hollaback = callbacks[i];
if ( typeof hollaback === 'function' ) { if ( typeof hollaback === 'function' ) {
hollaback.call( instance.element, $elems ); hollaback.call( instance.element, $elems, instance );
} }
} }
isCallbackTriggered = true; isCallbackTriggered = true;

4
jquery.isotope.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save