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 %}
$('#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
_posts/tests/2012-02-07-onlayout.html

@ -5,7 +5,7 @@ category: tests
---
<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 @@ category: tests
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() {

4
jquery.isotope.js

@ -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;

4
jquery.isotope.min.js vendored

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