Browse Source

Merge branch 'master' into gh-pages

v1
David DeSandro 14 years ago
parent
commit
0ece9292cb
  1. 64
      _layouts/elements.html
  2. 11
      _posts/demos/2010-12-29-layout-modes.html
  3. 21
      _posts/demos/2010-12-30-filtering.html
  4. 13
      _posts/demos/2010-12-30-sorting.html
  5. 34
      _posts/demos/2010-12-31-relayout.html
  6. 25
      _posts/demos/2011-01-02-adding-items.html
  7. 41
      _posts/demos/2011-03-29-combination-filters.html
  8. 160
      _posts/tests/2011-05-24-elements-complete-test.html
  9. 136
      jquery.isotope.js
  10. 4
      jquery.isotope.min.js

64
_layouts/elements.html

@ -54,46 +54,44 @@
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script src="../js/fake-element.js"></script> <script src="../js/fake-element.js"></script>
<script> <script>
$(function(){
var $container = $('#container');
$('#filters').find('a').click(function(){
// get href attribute, minus the #, plus a . to make it a class
var filterName = '.' + $(this).attr('href').slice(1);
filterName = filterName === '.show-all' ? '*' : filterName;
$container.isotope({ filter: filterName })
return false;
});
var $container = $('#container'); {% include sort-buttons.js %}
$('#filters').find('a').click(function(){
// get href attribute, minus the #, plus a . to make it a class
var filterName = '.' + $(this).attr('href').slice(1);
filterName = filterName === '.show-all' ? '*' : filterName;
$container.isotope({ filter: filterName })
return false;
});
{% include sort-buttons.js %}
// change size of clicked element
$container.find('.element').live('click', function(){
$(this).toggleClass('large');
$container.isotope('reLayout');
});
// toggle variable sizes of all elements // change size of clicked element
$('#toggle-sizes').find('a').click(function(){ $container.find('.element').live('click', function(){
$container $(this).toggleClass('large');
.toggleClass('variable-sizes') $container.isotope('reLayout');
.isotope('reLayout'); });
return false;
});
{% include layout-change.js %} // toggle variable sizes of all elements
$('#toggle-sizes').find('a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
{% include add-buttons.js %} {% include layout-change.js %}
$('#shuffle a').click(function(){ {% include add-buttons.js %}
$container.isotope('shuffle');
return false;
});
{% include option-buttons.js %} $('#shuffle a').click(function(){
$container.isotope('shuffle');
return false;
});
$(function(){ {% include option-buttons.js %}
$container.isotope({ $container.isotope({
itemSelector : '.element', itemSelector : '.element',

11
_posts/demos/2010-12-29-layout-modes.html

@ -25,14 +25,13 @@ related: layouts
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
$(function(){
var $container = $('#container');
var $container = $('#container');
{% include layout-change.js %} {% include layout-change.js %}
{% include option-buttons.js %}
$(function(){ {% include option-buttons.js %}
$container.isotope({ $container.isotope({
itemSelector : '.element', itemSelector : '.element',

21
_posts/demos/2010-12-30-filtering.html

@ -39,19 +39,18 @@ related: filtering
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
$(function(){
var $container = $('#container');
var $container = $('#container');
// filter buttons // filter buttons
$('#filters a').click(function(){ $('#filters a').click(function(){
var selector = $(this).attr('data-filter'); var selector = $(this).attr('data-filter');
$container.isotope({ filter: selector }); $container.isotope({ filter: selector });
return false; return false;
}); });
{% include option-buttons.js %}
$(function(){ {% include option-buttons.js %}
$container.isotope({ $container.isotope({
itemSelector : '.element' itemSelector : '.element'

13
_posts/demos/2010-12-30-sorting.html

@ -26,15 +26,14 @@ related: sorting
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
var $container = $('#container');
{% include sort-buttons.js %}
{% include option-buttons.js %}
$(function(){ $(function(){
var $container = $('#container');
{% include sort-buttons.js %}
{% include option-buttons.js %}
$container.isotope({ $container.isotope({
itemSelector : '.element', itemSelector : '.element',
getSortData : { getSortData : {

34
_posts/demos/2010-12-31-relayout.html

@ -25,26 +25,24 @@ related: methods
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
var $container = $('#container');
// toggle variable sizes of all elements
$('#toggle-sizes a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
// change size of clicked element
$container.find('.element').live('click', function(){
$(this).toggleClass('large');
$container.isotope('reLayout');
});
$(function(){ $(function(){
var $container = $('#container');
// toggle variable sizes of all elements
$('#toggle-sizes a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
// change size of clicked element
$container.find('.element').live('click', function(){
$(this).toggleClass('large');
$container.isotope('reLayout');
});
$container.isotope({ $container.isotope({
itemSelector: '.element', itemSelector: '.element',
masonry : { masonry : {

25
_posts/demos/2011-01-02-adding-items.html

@ -31,22 +31,21 @@ related: methods
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script src="../js/fake-element.js"></script> <script src="../js/fake-element.js"></script>
<script> <script>
$(function(){
var $container = $('#container');
var $container = $('#container'); {% include add-buttons.js %}
{% include add-buttons.js %} $('#prepend a').click(function(){
var $newEls = $( fakeElement.getGroup() );
$container
.prepend( $newEls ).isotope('reloadItems').isotope({ sortBy: 'original-order' })
// set sort back to symbol for inserting
.isotope('option', { sortBy: 'symbol' });
$('#prepend a').click(function(){ return false;
var $newEls = $( fakeElement.getGroup() ); });
$container
.prepend( $newEls ).isotope('reloadItems').isotope({ sortBy: 'original-order' })
// set sort back to symbol for inserting
.isotope('option', { sortBy: 'symbol' });
return false;
});
$(function(){
$container.isotope({ $container.isotope({
itemSelector : '.element', itemSelector : '.element',

41
_posts/demos/2011-03-29-combination-filters.html

@ -57,31 +57,30 @@ schema:
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
$(function(){
var $container = $('#container'),
filters = {};
var $container = $('#container'), // filter buttons
filters = {}; $('.filter a').click(function(){
var $this = $(this),
isoFilters = [],
prop, selector;
// store filter value in object
// i.e. filters.color = 'red'
filters[ $this.data('group') ] = $this.data('filter');
// filter buttons for ( prop in filters ) {
$('.filter a').click(function(){ isoFilters.push( filters[ prop ] )
var $this = $(this), }
isoFilters = [], selector = isoFilters.join('');
prop, selector; $container.isotope({ filter: selector });
// store filter value in object
// i.e. filters.color = 'red'
filters[ $this.data('group') ] = $this.data('filter');
for ( prop in filters ) {
isoFilters.push( filters[ prop ] )
}
selector = isoFilters.join('');
$container.isotope({ filter: selector });
return false; return false;
}); });
{% include option-buttons.js %}
$(function(){ {% include option-buttons.js %}
$container.isotope({ $container.isotope({
itemSelector : '.color-shape', itemSelector : '.color-shape',

160
_posts/tests/2011-05-24-elements-complete-test.html

@ -0,0 +1,160 @@
---
title: elements complete test
layout: demo
category: tests
---
<section id="copy">
<p>Isotope&rsquo;s capabilities are designed to be used together cohesively. You can do it all &mdash; filter, sort, change layout modes, add items &mdash; and Isotope will handle it with ease.</p>
</section>
<section id="options" class="clearfix">
<h3>Filters</h3>
<ul id="filters" class="option-set floated clearfix">
<li><a href="#show-all" class="selected">show all</a></li>
<li><a href="#metalloid">metalloid</a></li>
<li><a href="#metal">metal</a></li>
<li><a href="#alkali">alkali</a></li>
<li><a href="#alkaline-earth">alkaline-earth</a></li>
<li><a href="#inner-transition">inner-transition</a></li>
<li><a href="#lanthanoid">lanthanoid</a></li>
<li><a href="#actinoid">actinoid</a></li>
<li><a href="#transition">transition</a></li>
<li><a href="#post-transition">post-transition</a></li>
<li><a href="#nonmetal">nonmetal</a></li>
<li><a href="#other">other</a></li>
<li><a href="#halogen">halogen</a></li>
<li><a href="#noble-gas">noble-gas</a></li>
</ul>
{% include sort-buttons.html %}
{% include layout-options.html %}
<h3>Etc</h3>
<ul id="etc" class="floated clearfix">
<li id="toggle-sizes"><a href="#toggle-sizes">Toggle variable sizes</a></li>
<li id="insert"><a href="#insert">Insert new elements</a></li>
<li id="append"><a href='#append'>Append new elements</a></li>
<!-- <li id="shuffle"><a href='#shuffle'>Shuffle</a></li> -->
</ul>
</section> <!-- #options -->
<div id="container" class="clickable clearfix">
{% for elem_number in site.random_order %}
{% assign element = site.elements[elem_number] %}
{% include element-partial.html %}
{% endfor %}
</div>
<script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script>
<script src="../js/fake-element.js"></script>
<script>
var $container = $('#container');
$('#filters').find('a').click(function(){
console.time('filter');
// get href attribute, minus the #, plus a . to make it a class
var filterName = '.' + $(this).attr('href').slice(1);
filterName = filterName === '.show-all' ? '*' : filterName;
$container.isotope({ filter: filterName })
console.timeEnd('filter');
return false;
});
// sorting
$('#sort a').click(function(){
console.time('sort');
// get href attribute, minus the #
var $this = $(this),
sortName = $this.attr('href').slice(1),
asc = $this.parents('.sort').hasClass('asc');
$container.isotope({
sortBy : sortName,
sortAscending : asc
});
console.timeEnd('sort');
return false;
});
// change size of clicked element
$container.find('.element').live('click', function(){
$(this).toggleClass('large');
$container.isotope('reLayout');
});
// toggle variable sizes of all elements
$('#toggle-sizes').find('a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
{% include layout-change.js %}
{% include add-buttons.js %}
$('#shuffle a').click(function(){
$container.isotope('shuffle');
return false;
});
{% include option-buttons.js %}
$(function(){
console.time('init');
$container.isotope({
itemSelector : '.element',
// layoutMode : 'fitRows',
masonry : {
columnWidth : 120
},
masonryHorizontal : {
rowHeight: 120
},
cellsByRow : {
columnWidth : 240,
rowHeight : 240
},
cellsByColumn : {
columnWidth : 240,
rowHeight : 240
},
animationEngine : $.browser.opera ? 'jquery' : 'best-available',
// animationEngine : 'jquery',
getSortData : {
symbol : function( $elem ) {
return $elem.attr('data-symbol');
},
category : function( $elem ) {
return $elem.attr('data-category');
},
number : function( $elem ) {
return parseInt( $elem.find('.number').text(), 10 );
},
weight : function( $elem ) {
return parseFloat( $elem.find('.weight').text().replace( /[\(\)]/g, '') );
},
name : function ( $elem ) {
return $elem.find('.name').text();
}
}
});
console.timeEnd('init');
});
</script>

136
jquery.isotope.js

@ -1,5 +1,5 @@
/** /**
* Isotope v1.3.110524 * Isotope v1.3.110525
* An exquisite jQuery plugin for magical layouts * An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co * http://isotope.metafizzy.co
* *
@ -179,9 +179,8 @@
; ;
var setIsoTransform = function ( elem, name, value ) { var setIsoTransform = function ( elem, name, value ) {
var $elem = $(elem),
// unpack current transform data // unpack current transform data
data = $elem.data('isoTransform') || {}, var data = $.data( elem, 'isoTransform' ) || {},
newData = {}, newData = {},
fnName, fnName,
transformObj = {}, transformObj = {},
@ -206,7 +205,7 @@
valueFns = translateFn + scaleFn; valueFns = translateFn + scaleFn;
// set data back in elem // set data back in elem
$elem.data( 'isoTransform', data ); $.data( elem, 'isoTransform', data );
// set name to vendor specific property // set name to vendor specific property
elem.style[ transformProp ] = valueFns; elem.style[ transformProp ] = valueFns;
@ -438,13 +437,12 @@
}, },
option: function( key, value ){ option : function( opts ){
// change options AFTER initialization: // change options AFTER initialization:
// signature: $('#foo').bar({ cool:false }); // signature: $('#foo').bar({ cool:false });
if ( $.isPlainObject( key ) ){ if ( $.isPlainObject( opts ) ){
this.options = $.extend(true, this.options, key); this.options = $.extend( true, this.options, opts );
var optionName; for ( var optionName in opts ) {
for ( optionName in key ) {
this._updateOption( optionName ); this._updateOption( optionName );
} }
} }
@ -535,8 +533,8 @@
for ( var key in getSortData ) { for ( var key in getSortData ) {
sortData[ key ] = getSortData[ key ]( $this, instance ); sortData[ key ] = getSortData[ key ]( $this, instance );
} }
// apply sort data to $element // apply sort data to element
$this.data( 'isotope-sort-data', sortData ); $.data( this, 'isotope-sort-data', sortData );
if ( isIncrementingElemCount ) { if ( isIncrementingElemCount ) {
instance.elemCount ++; instance.elemCount ++;
} }
@ -564,7 +562,7 @@
}, },
_getSorter : function( elem, sortBy ) { _getSorter : function( elem, sortBy ) {
return $(elem).data('isotope-sort-data')[ sortBy ]; return $.data( elem, 'isotope-sort-data' )[ sortBy ];
}, },
// ====================== Layout Helpers ====================== // ====================== Layout Helpers ======================
@ -765,19 +763,18 @@
size = isRows ? 'height' : 'width', size = isRows ? 'height' : 'width',
UCSize = isRows ? 'Height' : 'Width', UCSize = isRows ? 'Height' : 'Width',
segmentsName = isRows ? 'rows' : 'cols', segmentsName = isRows ? 'rows' : 'cols',
containerSize = this.element[ size ](),
segments, segments,
segmentSize; segmentSize;
this[ size ] = this.element[ size ]();
// i.e. options.masonry && options.masonry.columnWidth // i.e. options.masonry && options.masonry.columnWidth
segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] || segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
// or use the size of the first item // or use the size of the first item
this.$filteredAtoms[ 'outer' + UCSize ](true) || this.$filteredAtoms[ 'outer' + UCSize ](true) ||
// if there's no items, use size of container // if there's no items, use size of container
this[ size ]; containerSize;
segments = Math.floor( this[ size ] / segmentSize ); segments = Math.floor( containerSize / segmentSize );
segments = Math.max( segments, 1 ); segments = Math.max( segments, 1 );
// i.e. this.masonry.cols = .... // i.e. this.masonry.cols = ....
@ -812,20 +809,21 @@
}, },
_masonryLayout : function( $elems ) { _masonryLayout : function( $elems ) {
var instance = this; var instance = this,
props = instance.masonry;
$elems.each(function(){ $elems.each(function(){
var $this = $(this), var $this = $(this),
//how many columns does this brick span //how many columns does this brick span
colSpan = Math.ceil( $this.outerWidth(true) / instance.masonry.columnWidth ); colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
colSpan = Math.min( colSpan, instance.masonry.cols ); colSpan = Math.min( colSpan, props.cols );
if ( colSpan === 1 ) { if ( colSpan === 1 ) {
// if brick spans only one column, just like singleMode // if brick spans only one column, just like singleMode
instance._masonryPlaceBrick( $this, instance.masonry.colYs ); instance._masonryPlaceBrick( $this, props.colYs );
} else { } else {
// brick spans more than one column // brick spans more than one column
// how many different places could this brick fit horizontally // how many different places could this brick fit horizontally
var groupCount = instance.masonry.cols + 1 - colSpan, var groupCount = props.cols + 1 - colSpan,
groupY = [], groupY = [],
groupColY, groupColY,
i; i;
@ -833,7 +831,7 @@
// for each group potential horizontal position // for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) { for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group // make an array of colY values for that one group
groupColY = instance.masonry.colYs.slice( i, i+colSpan ); groupColY = props.colYs.slice( i, i+colSpan );
// and get the max value of the array // and get the max value of the array
groupY[i] = Math.max.apply( Math, groupColY ); groupY[i] = Math.max.apply( Math, groupColY );
} }
@ -846,17 +844,15 @@
// worker method that places brick in the columnSet // worker method that places brick in the columnSet
// with the the minY // with the the minY
_masonryPlaceBrick : function( $brick, setY ) { _masonryPlaceBrick : function( $brick, setY ) {
// get the minimum Y value from the columns // get the minimum Y value from the columns
var minimumY = Math.min.apply( Math, setY ), var minimumY = Math.min.apply( Math, setY ),
setHeight = minimumY + $brick.outerHeight(true), shortCol = 0;
i = setY.length,
shortCol = i, // Find index of short column, the first from the left
setSpan = this.masonry.cols + 1 - i, for (var i=0, len = setY.length; i < len; i++) {
x, y ;
// Which column has the minY value, closest to the left
while (i--) {
if ( setY[i] === minimumY ) { if ( setY[i] === minimumY ) {
shortCol = i; shortCol = i;
break;
} }
} }
@ -866,6 +862,8 @@
this._pushPosition( $brick, x, y ); this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns // apply setHeight to necessary columns
var setHeight = minimumY + $brick.outerHeight(true),
setSpan = this.masonry.cols + 1 - len;
for ( i=0; i < setSpan; i++ ) { for ( i=0; i < setSpan; i++ ) {
this.masonry.colYs[ shortCol + i ] = setHeight; this.masonry.colYs[ shortCol + i ] = setHeight;
} }
@ -892,8 +890,9 @@
}, },
_fitRowsLayout : function( $elems ) { _fitRowsLayout : function( $elems ) {
this.width = this.element.width(); var instance = this,
var instance = this; containerWidth = this.element.width(),
props = this.fitRows;
$elems.each( function() { $elems.each( function() {
var $this = $(this), var $this = $(this),
@ -901,19 +900,17 @@
atomH = $this.outerHeight(true), atomH = $this.outerHeight(true),
x, y; x, y;
if ( instance.fitRows.x !== 0 && atomW + instance.fitRows.x > instance.width ) { if ( props.x !== 0 && atomW + props.x > containerWidth ) {
// if this element cannot fit in the current row // if this element cannot fit in the current row
instance.fitRows.x = 0; props.x = 0;
instance.fitRows.y = instance.fitRows.height; props.y = props.height;
} }
// position the atom // position the atom
x = instance.fitRows.x; instance._pushPosition( $this, props.x, props.y );
y = instance.fitRows.y;
instance._pushPosition( $this, x, y );
instance.fitRows.height = Math.max( instance.fitRows.y + atomH, instance.fitRows.height ); props.height = Math.max( props.y + atomH, props.height );
instance.fitRows.x += atomW; props.x += atomW;
}); });
}, },
@ -946,10 +943,8 @@
var $this = $(this), var $this = $(this),
col = props.index % props.cols, col = props.index % props.cols,
row = ~~( props.index / props.cols ), row = ~~( props.index / props.cols ),
x = ( col + 0.5 ) * props.columnWidth - x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
$this.outerWidth(true) / 2, y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
y = ( row + 0.5 ) * props.rowHeight -
$this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
props.index ++; props.index ++;
}); });
@ -1005,27 +1000,28 @@
}, },
_masonryHorizontalLayout : function( $elems ) { _masonryHorizontalLayout : function( $elems ) {
var instance = this; var instance = this,
props = instance.masonryHorizontal;
$elems.each(function(){ $elems.each(function(){
var $this = $(this), var $this = $(this),
//how many rows does this brick span //how many rows does this brick span
rowSpan = Math.ceil( $this.outerHeight(true) / instance.masonryHorizontal.rowHeight ); rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
rowSpan = Math.min( rowSpan, instance.masonryHorizontal.rows ); rowSpan = Math.min( rowSpan, props.rows );
if ( rowSpan === 1 ) { if ( rowSpan === 1 ) {
// if brick spans only one column, just like singleMode // if brick spans only one column, just like singleMode
instance._masonryHorizontalPlaceBrick( $this, instance.masonryHorizontal.rowXs ); instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
} else { } else {
// brick spans more than one row // brick spans more than one row
// how many different places could this brick fit horizontally // how many different places could this brick fit horizontally
var groupCount = instance.masonryHorizontal.rows + 1 - rowSpan, var groupCount = props.rows + 1 - rowSpan,
groupX = [], groupX = [],
groupRowX, i; groupRowX, i;
// for each group potential horizontal position // for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) { for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group // make an array of colY values for that one group
groupRowX = instance.masonryHorizontal.rowXs.slice( i, i+rowSpan ); groupRowX = props.rowXs.slice( i, i+rowSpan );
// and get the max value of the array // and get the max value of the array
groupX[i] = Math.max.apply( Math, groupRowX ); groupX[i] = Math.max.apply( Math, groupRowX );
} }
@ -1036,18 +1032,14 @@
}, },
_masonryHorizontalPlaceBrick : function( $brick, setX ) { _masonryHorizontalPlaceBrick : function( $brick, setX ) {
// here, `this` refers to a child element or "brick" // get the minimum Y value from the columns
// get the minimum Y value from the columns
var minimumX = Math.min.apply( Math, setX ), var minimumX = Math.min.apply( Math, setX ),
setWidth = minimumX + $brick.outerWidth(true), smallRow = 0;
i = setX.length, // Find index of smallest row, the first from the top
smallRow = i, for (var i=0, len = setX.length; i < len; i++) {
setSpan = this.masonryHorizontal.rows + 1 - i,
x, y ;
// Which column has the minY value, closest to the left
while (i--) {
if ( setX[i] === minimumX ) { if ( setX[i] === minimumX ) {
smallRow = i; smallRow = i;
break;
} }
} }
@ -1057,10 +1049,11 @@
this._pushPosition( $brick, x, y ); this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns // apply setHeight to necessary columns
var setWidth = minimumX + $brick.outerWidth(true),
setSpan = this.masonryHorizontal.rows + 1 - len;
for ( i=0; i < setSpan; i++ ) { for ( i=0; i < setSpan; i++ ) {
this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth; this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
} }
}, },
_masonryHorizontalGetContainerSize : function() { _masonryHorizontalGetContainerSize : function() {
@ -1084,27 +1077,26 @@
}, },
_fitColumnsLayout : function( $elems ) { _fitColumnsLayout : function( $elems ) {
var instance = this; var instance = this,
this.height = this.element.height(); containerHeight = this.element.height(),
props = this.fitColumns;
$elems.each( function() { $elems.each( function() {
var $this = $(this), var $this = $(this),
atomW = $this.outerWidth(true), atomW = $this.outerWidth(true),
atomH = $this.outerHeight(true), atomH = $this.outerHeight(true),
x, y; x, y;
if ( instance.fitColumns.y !== 0 && atomH + instance.fitColumns.y > instance.height ) { if ( props.y !== 0 && atomH + props.y > containerHeight ) {
// if this element cannot fit in the current column // if this element cannot fit in the current column
instance.fitColumns.x = instance.fitColumns.width; props.x = props.width;
instance.fitColumns.y = 0; props.y = 0;
} }
// position the atom // position the atom
x = instance.fitColumns.x; instance._pushPosition( $this, props.x, props.y );
y = instance.fitColumns.y;
instance._pushPosition( $this, x, y );
instance.fitColumns.width = Math.max( instance.fitColumns.x + atomW, instance.fitColumns.width ); props.width = Math.max( props.x + atomW, props.width );
instance.fitColumns.y += atomH; props.y += atomH;
}); });
}, },
@ -1245,7 +1237,7 @@
var instance = $.data( this, 'isotope' ); var instance = $.data( this, 'isotope' );
if ( instance ) { if ( instance ) {
// apply options & init // apply options & init
instance.option( options || {} ); instance.option( options );
instance._init(); instance._init();
} else { } else {
// initialize new instance // initialize new instance

4
jquery.isotope.min.js vendored

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