mirror of https://github.com/metafizzy/isotope
Filter & sort magical layouts
http://isotope.metafizzy.co
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
3.8 KiB
160 lines
3.8 KiB
14 years ago
|
---
|
||
|
|
||
|
title: Methods
|
||
|
category: docs
|
||
14 years ago
|
layout: default
|
||
14 years ago
|
toc:
|
||
|
- { title: addItems, anchor: additems }
|
||
|
- { title: appended, anchor: appended }
|
||
|
- { title: destroy, anchor: destroy }
|
||
|
- { title: insert, anchor: insert }
|
||
|
- { title: layout, anchor: layout }
|
||
|
- { title: option, anchor: option }
|
||
|
- { title: reLayout, anchor: relayout }
|
||
14 years ago
|
- { title: reloadItems, anchor: reloaditems }
|
||
14 years ago
|
- { title: remove, anchor: remove }
|
||
14 years ago
|
- { title: shuffle, anchor: shuffle }
|
||
14 years ago
|
- { title: updateSortData, anchor: updatesortdata }
|
||
14 years ago
|
|
||
|
---
|
||
|
|
||
14 years ago
|
Isotope offers several methods to extend functionality. Isotope's methods follow the jQuery UI pattern.
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
$('#container').isotope( 'methodName', [optionalParameters] )
|
||
|
|
||
|
{% endhighlight %}
|
||
14 years ago
|
|
||
14 years ago
|
## addItems
|
||
14 years ago
|
|
||
14 years ago
|
{% highlight javascript %}
|
||
14 years ago
|
|
||
14 years ago
|
.isotope( 'addItems', $items, callback )
|
||
14 years ago
|
|
||
14 years ago
|
{% endhighlight %}
|
||
14 years ago
|
|
||
13 years ago
|
Adds item elements to the pool of item elements of the container, but does not sort, filter or layout. See [Adding items](adding-items.html) for more details. The argument within the callback is the group of elements that were added.
|
||
14 years ago
|
|
||
14 years ago
|
[**See Demo: Adding items**](../demos/adding-items.html)
|
||
14 years ago
|
|
||
14 years ago
|
## appended
|
||
14 years ago
|
|
||
14 years ago
|
{% highlight javascript %}
|
||
14 years ago
|
|
||
14 years ago
|
.isotope( 'appended', $items, callback )
|
||
14 years ago
|
|
||
14 years ago
|
{% endhighlight %}
|
||
14 years ago
|
|
||
14 years ago
|
Adds item elements via `addItems` method, then triggers `layout` just for those new elements. Useful for Infinite Scroll. See [Adding items](adding-items.html) for more details.
|
||
14 years ago
|
|
||
14 years ago
|
[**See Demo: Adding items**](../demos/adding-items.html)
|
||
14 years ago
|
|
||
14 years ago
|
## destroy
|
||
14 years ago
|
|
||
14 years ago
|
{% highlight javascript %}
|
||
|
|
||
|
.isotope( 'destroy' )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
Removes Isotope functionality completely. Returns element back to pre-init state.
|
||
|
|
||
14 years ago
|
## insert
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
14 years ago
|
.isotope( 'insert', $items, callback )
|
||
14 years ago
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
Appends items elements to container, adds items to via `addItems` method, and then triggers `reLayout` method so new elements are properly filtered, sorted and laid-out. See [Adding items](adding-items.html) for more details.
|
||
14 years ago
|
|
||
|
[**See Demo: Adding items**](../demos/adding-items.html).
|
||
14 years ago
|
|
||
14 years ago
|
## layout
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
14 years ago
|
.isotope( 'layout', $items, callback )
|
||
14 years ago
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
Positions specified item elements in layout.
|
||
14 years ago
|
|
||
|
`layout` will only position specified elements, and those elements will be positioned at the end of layout. Whereas `reLayout` will position all elements in the Isotope widget.
|
||
14 years ago
|
|
||
14 years ago
|
## option
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
.isotope( 'option', options )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
Sets options for plugin instance. Unlike passing options through `.isotope()`, using the `option` method will not trigger layout.
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
// sets multiple options
|
||
|
.isotope( 'option', { layoutMode: 'fitRows', filter: '.my-filter' } )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
|
||
14 years ago
|
## reLayout
|
||
14 years ago
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
.isotope( 'reLayout', callback )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
Resets layout properties and lays-out every item element.
|
||
|
|
||
14 years ago
|
[**See Demo: reLayout**](../demos/relayout.html)
|
||
|
|
||
14 years ago
|
## reloadItems
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
.isotope( 'reloadItems' )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
Re-collects all item elements in their current order in the DOM. Useful for prepending.
|
||
|
|
||
|
[**See Demo: Adding items**](../demos/adding-items.html).
|
||
|
|
||
14 years ago
|
## remove
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
13 years ago
|
.isotope( 'remove', $items, callback )
|
||
14 years ago
|
|
||
|
{% endhighlight %}
|
||
|
|
||
14 years ago
|
Removes specified item elements from Isotope widget and the DOM.
|
||
|
|
||
13 years ago
|
[**See Demo: Removing**](../demos/removing.html).
|
||
|
|
||
14 years ago
|
## shuffle
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
14 years ago
|
.isotope( 'shuffle', callback )
|
||
14 years ago
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
Shuffles order of items. Sets [`sortBy` option](options.html#sortby) to [`'random'`](sorting.html#sortby_option).
|
||
|
|
||
14 years ago
|
## updateSortData
|
||
|
|
||
|
{% highlight javascript %}
|
||
|
|
||
|
.isotope( 'updateSortData', $items )
|
||
|
|
||
|
{% endhighlight %}
|
||
|
|
||
|
Updates the sorting data on specified item elements. This method is useful if the data within an item is changed dynamically after Isotope has been initialized.
|