Browse Source

Merge branch 'master' of github.com:desandro/isotope

pull/96/head
David DeSandro 14 years ago
parent
commit
8b749a4793
  1. 9
      _posts/docs/2010-12-04-methods.mdown
  2. 7
      _posts/docs/2010-12-11-help.mdown
  3. 66
      jquery.isotope.js
  4. 4
      jquery.isotope.min.js

9
_posts/docs/2010-12-04-methods.mdown

@ -92,20 +92,13 @@ Positions specified item elements in layout.
{% endhighlight %} {% endhighlight %}
Modifies options for plugin instance. Can be used to get and set options. Unlike passing options through `.isotope()`, using the `option` method will not trigger layout. Sets options for plugin instance. Unlike passing options through `.isotope()`, using the `option` method will not trigger layout.
{% highlight javascript %} {% highlight javascript %}
// sets multiple options // sets multiple options
.isotope( 'option', { layoutMode: 'fitRows', filter: '.my-filter' } ) .isotope( 'option', { layoutMode: 'fitRows', filter: '.my-filter' } )
// set single option
.isotope( 'option', 'layoutMode', 'straightDown' )
// get option
.isotope( 'option', 'layoutMode' )
// returns 'straightDown'
{% endhighlight %} {% endhighlight %}

7
_posts/docs/2010-12-11-troubleshooting.mdown → _posts/docs/2010-12-11-help.mdown

@ -1,6 +1,6 @@
--- ---
title: Troubleshooting title: Help
category: docs category: docs
layout: doc layout: doc
related: z-etc related: z-etc
@ -13,7 +13,6 @@ toc:
- { title: @font-face fonts, anchor: fontface_fonts } - { title: @font-face fonts, anchor: fontface_fonts }
- { title: CSS transforms in Opera, anchor: css_transforms_in_opera } - { title: CSS transforms in Opera, anchor: css_transforms_in_opera }
- { title: Infinite Scroll with filtering or sorting, anchor: infinite_scroll_with_filtering_or_sorting} - { title: Infinite Scroll with filtering or sorting, anchor: infinite_scroll_with_filtering_or_sorting}
- { title: Prepending items, anchor: prepending_items }
- { title: Flash, anchor: flash } - { title: Flash, anchor: flash }
--- ---
@ -123,10 +122,6 @@ I recommend against using Infinite Scroll with filtering or sorting. This combin
If you do plan on implementing Infinite Scroll with filtering or sorting (which is a _bad idea_), use the `insert` method instead of `appended`. If you do plan on implementing Infinite Scroll with filtering or sorting (which is a _bad idea_), use the `insert` method instead of `appended`.
## Prepending items
While there is no prepend method built into Isotope, you can add items to the beginning of a Isotope layout by using sorting and [`updateSortData`](methods.html#getsortdata). See [Isotope - prepending items on jsFiddle](http://jsfiddle.net/desandro/zXWkw/4/).
## Flash ## Flash
[Using CSS transforms with Flash content is a bit buggy in Safari and Firefox](http://dropshado.ws/post/4085720152/css-transforms-breaking-flash). This is problematic when using Isotope on item elements that contain Flash content like YouTube or Vimeo videos, Flash ads, or Flash audio players. [Using CSS transforms with Flash content is a bit buggy in Safari and Firefox](http://dropshado.ws/post/4085720152/css-transforms-breaking-flash). This is problematic when using Isotope on item elements that contain Flash content like YouTube or Vimeo videos, Flash ads, or Flash audio players.

66
jquery.isotope.js

@ -1,5 +1,5 @@
/** /**
* Isotope v1.3.110523 * Isotope v1.3.110524
* An exquisite jQuery plugin for magical layouts * An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co * http://isotope.metafizzy.co
* *
@ -387,10 +387,8 @@
this.reloadItems(); this.reloadItems();
// get top left position of where the bricks should be // get top left position of where the bricks should be
var $cursor = $( document.createElement('div') ); var $cursor = $( document.createElement('div') ).prependTo( this.element );
this.element.prepend( $cursor ); this.offset = $cursor.position();
this.posTop = Math.round( $cursor.position().top );
this.posLeft = Math.round( $cursor.position().left );
$cursor.remove(); $cursor.remove();
// add isotope class first time around // add isotope class first time around
@ -441,8 +439,7 @@
}, },
option: function( key, value ){ option: function( key, value ){
// get/change options AFTER initialization: // change options AFTER initialization:
// signature: $('#foo').bar({ cool:false }); // signature: $('#foo').bar({ cool:false });
if ( $.isPlainObject( key ) ){ if ( $.isPlainObject( key ) ){
this.options = $.extend(true, this.options, key); this.options = $.extend(true, this.options, key);
@ -450,11 +447,6 @@
for ( optionName in key ) { for ( optionName in key ) {
this._updateOption( optionName ); this._updateOption( optionName );
} }
// signature: $('#foo').bar('option', 'baz', false);
} else {
this.options[ key ] = value;
this._updateOption( key );
} }
}, },
@ -586,6 +578,8 @@
}, },
_pushPosition : function( $elem, x, y ) { _pushPosition : function( $elem, x, y ) {
x += this.offset.left;
y += this.offset.top;
var position = this.getPositionStyles( x, y ); var position = this.getPositionStyles( x, y );
this.styleQueue.push({ $el: $elem, style: position }); this.styleQueue.push({ $el: $elem, style: position });
if ( this.options.itemPositionDataEnabled ) { if ( this.options.itemPositionDataEnabled ) {
@ -813,7 +807,7 @@
var i = this.masonry.cols; var i = this.masonry.cols;
this.masonry.colYs = []; this.masonry.colYs = [];
while (i--) { while (i--) {
this.masonry.colYs.push( this.posTop ); this.masonry.colYs.push( 0 );
} }
}, },
@ -867,7 +861,7 @@
} }
// position the brick // position the brick
x = this.masonry.columnWidth * shortCol + this.posLeft; x = this.masonry.columnWidth * shortCol;
y = minimumY; y = minimumY;
this._pushPosition( $brick, x, y ); this._pushPosition( $brick, x, y );
@ -879,7 +873,7 @@
}, },
_masonryGetContainerSize : function() { _masonryGetContainerSize : function() {
var containerHeight = Math.max.apply( Math, this.masonry.colYs ) - this.posTop; var containerHeight = Math.max.apply( Math, this.masonry.colYs );
return { height: containerHeight }; return { height: containerHeight };
}, },
@ -914,8 +908,8 @@
} }
// position the atom // position the atom
x = instance.fitRows.x + instance.posLeft; x = instance.fitRows.x;
y = instance.fitRows.y + instance.posTop; y = instance.fitRows.y;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
instance.fitRows.height = Math.max( instance.fitRows.y + atomH, instance.fitRows.height ); instance.fitRows.height = Math.max( instance.fitRows.y + atomH, instance.fitRows.height );
@ -953,16 +947,16 @@
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 + instance.posLeft, $this.outerWidth(true) / 2,
y = ( row + 0.5 ) * props.rowHeight - y = ( row + 0.5 ) * props.rowHeight -
$this.outerHeight(true) / 2 + instance.posTop; $this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
props.index ++; props.index ++;
}); });
}, },
_cellsByRowGetContainerSize : function() { _cellsByRowGetContainerSize : function() {
return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.posTop }; return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
}, },
_cellsByRowResizeChanged : function() { _cellsByRowResizeChanged : function() {
@ -981,15 +975,14 @@
_straightDownLayout : function( $elems ) { _straightDownLayout : function( $elems ) {
var instance = this; var instance = this;
$elems.each( function( i ){ $elems.each( function( i ){
var $this = $(this), var $this = $(this);
y = instance.straightDown.y + instance.posTop; instance._pushPosition( $this, 0, instance.straightDown.y );
instance._pushPosition( $this, instance.posLeft, y );
instance.straightDown.y += $this.outerHeight(true); instance.straightDown.y += $this.outerHeight(true);
}); });
}, },
_straightDownGetContainerSize : function() { _straightDownGetContainerSize : function() {
return { height : this.straightDown.y + this.posTop }; return { height : this.straightDown.y };
}, },
_straightDownResizeChanged : function() { _straightDownResizeChanged : function() {
@ -1007,7 +1000,7 @@
var i = this.masonryHorizontal.rows; var i = this.masonryHorizontal.rows;
this.masonryHorizontal.rowXs = []; this.masonryHorizontal.rowXs = [];
while (i--) { while (i--) {
this.masonryHorizontal.rowXs.push( this.posLeft ); this.masonryHorizontal.rowXs.push( 0 );
} }
}, },
@ -1060,7 +1053,7 @@
// position the brick // position the brick
x = minimumX; x = minimumX;
y = this.masonryHorizontal.rowHeight * smallRow + this.posTop; y = this.masonryHorizontal.rowHeight * smallRow;
this._pushPosition( $brick, x, y ); this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns // apply setHeight to necessary columns
@ -1071,7 +1064,7 @@
}, },
_masonryHorizontalGetContainerSize : function() { _masonryHorizontalGetContainerSize : function() {
var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs ) - this.posLeft; var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
return { width: containerWidth }; return { width: containerWidth };
}, },
@ -1106,8 +1099,8 @@
} }
// position the atom // position the atom
x = instance.fitColumns.x + instance.posLeft; x = instance.fitColumns.x;
y = instance.fitColumns.y + instance.posTop; y = instance.fitColumns.y;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
instance.fitColumns.width = Math.max( instance.fitColumns.x + atomW, instance.fitColumns.width ); instance.fitColumns.width = Math.max( instance.fitColumns.x + atomW, instance.fitColumns.width );
@ -1145,17 +1138,15 @@
var $this = $(this), var $this = $(this),
col = ~~( props.index / props.rows ), col = ~~( props.index / props.rows ),
row = props.index % props.rows, row = props.index % props.rows,
x = ( col + 0.5 ) * props.columnWidth - x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
$this.outerWidth(true) / 2 + instance.posLeft, y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
y = ( row + 0.5 ) * props.rowHeight -
$this.outerHeight(true) / 2 + instance.posTop;
instance._pushPosition( $this, x, y ); instance._pushPosition( $this, x, y );
props.index ++; props.index ++;
}); });
}, },
_cellsByColumnGetContainerSize : function() { _cellsByColumnGetContainerSize : function() {
return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth + this.posLeft }; return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
}, },
_cellsByColumnResizeChanged : function() { _cellsByColumnResizeChanged : function() {
@ -1173,15 +1164,14 @@
_straightAcrossLayout : function( $elems ) { _straightAcrossLayout : function( $elems ) {
var instance = this; var instance = this;
$elems.each( function( i ){ $elems.each( function( i ){
var $this = $(this), var $this = $(this);
x = instance.straightAcross.x + instance.posLeft; instance._pushPosition( $this, instance.straightAcross.x, 0 );
instance._pushPosition( $this, x, instance.posTop );
instance.straightAcross.x += $this.outerWidth(true); instance.straightAcross.x += $this.outerWidth(true);
}); });
}, },
_straightAcrossGetContainerSize : function() { _straightAcrossGetContainerSize : function() {
return { width : this.straightAcross.x + this.posLeft }; return { width : this.straightAcross.x };
}, },
_straightAcrossResizeChanged : function() { _straightAcrossResizeChanged : function() {

4
jquery.isotope.min.js vendored

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