From 829eaeadc6434e4d313b627ccff4e74c759a1051 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Mon, 31 Mar 2014 07:55:32 -0400 Subject: [PATCH] remove old files from v1 --- _posts/docs/2010-12-01-introduction.md | 172 -- _posts/docs/2010-12-03-options.md | 354 ----- _posts/docs/2010-12-04-methods.md | 159 -- _posts/docs/2010-12-05-layout-modes.md | 191 --- _posts/docs/2010-12-06-filtering.md | 109 -- _posts/docs/2010-12-07-sorting.md | 169 -- _posts/docs/2010-12-09-animating.md | 100 -- _posts/docs/2010-12-10-adding-items.md | 79 - _posts/docs/2011-05-25-extending-isotope.md | 174 -- .../2011-06-16-hash-history-jquery-bbq.md | 86 - _posts/docs/2011-12-11-help.md | 234 --- _posts/docs/2011-12-20-license.md | 79 - jquery.isotope.js | 1408 ----------------- jquery.isotope.min.js | 13 - minify.sh | 9 - 15 files changed, 3336 deletions(-) delete mode 100644 _posts/docs/2010-12-01-introduction.md delete mode 100644 _posts/docs/2010-12-03-options.md delete mode 100644 _posts/docs/2010-12-04-methods.md delete mode 100644 _posts/docs/2010-12-05-layout-modes.md delete mode 100644 _posts/docs/2010-12-06-filtering.md delete mode 100644 _posts/docs/2010-12-07-sorting.md delete mode 100644 _posts/docs/2010-12-09-animating.md delete mode 100644 _posts/docs/2010-12-10-adding-items.md delete mode 100644 _posts/docs/2011-05-25-extending-isotope.md delete mode 100644 _posts/docs/2011-06-16-hash-history-jquery-bbq.md delete mode 100644 _posts/docs/2011-12-11-help.md delete mode 100644 _posts/docs/2011-12-20-license.md delete mode 100644 jquery.isotope.js delete mode 100644 jquery.isotope.min.js delete mode 100755 minify.sh diff --git a/_posts/docs/2010-12-01-introduction.md b/_posts/docs/2010-12-01-introduction.md deleted file mode 100644 index 1e77440..0000000 --- a/_posts/docs/2010-12-01-introduction.md +++ /dev/null @@ -1,172 +0,0 @@ ---- - -title: Introduction -category: docs -layout: default -toc: - - { title: Features, anchor: features } - - { title: Licensing, anchor: licensing } - - { title: Getting started, anchor: getting_started } - - { title: Code repository, anchor: code_repository } - - { title: A word about moderation, anchor: moderation } - - { title: Acknowledgments, anchor: acknowledgments } - - ---- - -

Isotope: An exquisite jQuery plugin for magical layouts

- -## Features - -+ [**Layout modes**](layout-modes.html): Intelligent, dynamic layouts that can't be achieved with CSS alone. -+ [**Filtering**](filtering.html): Hide and reveal item elements easily with jQuery selectors. -+ [**Sorting**](sorting.html): Re-order item elements with sorting. Sorting data can be extracted from just about anything. -+ **Interoperability**: features can be utilized together for a cohesive experience. -+ **Progressive enhancement**: Isotope's [animation engine](animating.html) takes advantage of the best browser features when available — CSS transitions and transforms, GPU acceleration — but will also fall back to JavaScript animation for lesser browsers. - -## Commercial Licensing - -Isotope may be used in commercial projects and applications with the one-time purchase of a commercial license. [Read more about Isotope commercial licensing.](license.html) - - -

{% include developer-buy-button.html %} {% include org-buy-button.html %}

- -Purchasing accepts most credit cards and takes seconds. Once purchased, you'll receive a commercial license PDF and you will be all set to use Isotope in your commercial applications. - -For non-commercial, personal, or open source projects and applications, you may use Isotope under the terms of the MIT License. You may use Isotope for free. - -### Purchase via PayPal - -If you're having trouble using a credit card, try purchasing a license via PayPal: - -+ [Buy Developer License via PayPal](http://pul.ly/b/13620) -+ [Buy Organization License via PayPal](http://pul.ly/b/36595) - -## Getting started - -Isotope requires jQuery 1.4.3 and greater. - -### Markup - -Isotope works on a container element with a group of similar child items. - -{% highlight html %} - -
-
...
-
...
-
...
- ... -
- -{% endhighlight %} - -### Script - -{% highlight javascript %} - -$('#container').isotope({ - // options - itemSelector : '.item', - layoutMode : 'fitRows' -}); - -{% endhighlight %} - -[**See Demo: Basic**](../demos/basic.html) - -There are a number of [options](options.html) you can specify. Within the options is where you can [set the layout mode](layout-modes.html), [filter items](filtering.html), and [sort items](sorting.html). - -Additionally you can specify a callback after the options object. This function will be triggered after the animation has completed. - -{% highlight javascript %} - -$('#container').isotope({ filter: '.my-selector' }, function( $items ) { - var id = this.attr('id'), - len = $items.length; - console.log( 'Isotope has filtered for ' + len + ' items in #' + id ); -}); - -{% endhighlight %} - -Within this callback this refers to the container, and `$items` refers to the item elements. Both of these are jQuery objects and do _not_ need to be put in jQuery wrappers. - -### CSS - -Add these styles to your CSS for [filtering](filtering.html), [animation](animating.html) with CSS transitions, and [adding items](adding-items.html). - -{% highlight css %} - -/**** Isotope Filtering ****/ - -.isotope-item { - z-index: 2; -} - -.isotope-hidden.isotope-item { - pointer-events: none; - z-index: 1; -} - -/**** Isotope CSS3 transitions ****/ - -.isotope, -.isotope .isotope-item { - -webkit-transition-duration: 0.8s; - -moz-transition-duration: 0.8s; - -ms-transition-duration: 0.8s; - -o-transition-duration: 0.8s; - transition-duration: 0.8s; -} - -.isotope { - -webkit-transition-property: height, width; - -moz-transition-property: height, width; - -ms-transition-property: height, width; - -o-transition-property: height, width; - transition-property: height, width; -} - -.isotope .isotope-item { - -webkit-transition-property: -webkit-transform, opacity; - -moz-transition-property: -moz-transform, opacity; - -ms-transition-property: -ms-transform, opacity; - -o-transition-property: -o-transform, opacity; - transition-property: transform, opacity; -} - -/**** disabling Isotope CSS3 transitions ****/ - -.isotope.no-transition, -.isotope.no-transition .isotope-item, -.isotope .isotope-item.no-transition { - -webkit-transition-duration: 0s; - -moz-transition-duration: 0s; - -ms-transition-duration: 0s; - -o-transition-duration: 0s; - transition-duration: 0s; -} - -{% endhighlight %} - -## Code repository - -This project lives on GitHub at [github.com/desandro/isotope](http://github.com/desandro/isotope). There you can grab the latest code and follow development. - -## A word about moderation {: #moderation} - -Isotope enables a wealth of functionality. But just because you can take advantage of its numerous features together, doesn't mean you necessarily should. For each each feature you implement with Isotope, consider the benefit gained by users, at the cost of another level of complexity to your interface. - -## Acknowledgments - -+ [**"Cowboy" Ben Alman**](http://benalman.com/) for [jQuery BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (included with docs) -+ [**Louis-Rémi Babé**](http://twitter.com/Louis_Remi) for [jQuery smartresize](https://github.com/louisremi/jquery-smartresize) (used within Isotope) and for [jQuery transform](https://github.com/louisremi/jquery.transform.js) which clued me in to using jQuery 1.4.3's CSS hooks -+ [**Jacek Galanciak**](http://razorjack.net/) for [jQuery Quicksand](http://razorjack.net/quicksand/), an early kernel of inspiration -+ [**Ralph Holzmann**](http://twitter.com/#!/ralphholzmann) for re-writing the [jQuery Plugins/Authoring tutorial](http://docs.jquery.com/Plugins/Authoring) and opened my eyes to [Plugin Methods](http://docs.jquery.com/Plugins/Authoring#Plugin_Methods) pattern -+ [**Eric Hynds**](http://www.erichynds.com/) for his article [Using $.widget.bridge Outside of the Widget Factory](http://www.erichynds.com/jquery/using-jquery-ui-widget-factory-bridge/) which provided the architecture for Isotope -+ [**Paul Irish**](http://paul-irish.com) for [Infinite Scroll](http://infinite-scroll.com) (included with docs), the [imagesLoaded plugin](http://gist.github.com/268257) (included with Isotope), and [Debounced resize() plugin](http://paulirish.com/demo/resize) (provided base for smartresize) -+ The [**jQuery UI Team**](http://jqueryui.com/about) for [$.widget.bridge](https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L113-155) (partially used within Isotope) -+ The Modernizr team for [Modernizr](http://www.modernizr.com/) (partially used within Isotope) -+ [**Juriy Zaytsev aka "kangax"**](http://perfectionkills.com) for [getStyleProperty](http://perfectionkills.com/feature-testing-css-properties/) (used within Isotope) - - diff --git a/_posts/docs/2010-12-03-options.md b/_posts/docs/2010-12-03-options.md deleted file mode 100644 index 984e3ad..0000000 --- a/_posts/docs/2010-12-03-options.md +++ /dev/null @@ -1,354 +0,0 @@ ---- - -title: Options -category: docs -layout: default -body_class: option-def -toc: - - { title: animationEngine, anchor: animationengine } - - { title: animationOptions, anchor: animationoptions } - - { title: containerClass, anchor: containerclass } - - { title: containerStyle, anchor: containerstyle } - - { title: filter, anchor: filter } - - { title: getSortData, anchor: getsortdata } - - { title: hiddenClass, anchor: hiddenclass } - - { title: hiddenStyle, anchor: hiddenstyle } - - { title: itemClass, anchor: itemclass } - - { title: itemPositionDataEnabled, anchor: itempositiondataenabled } - - { title: itemSelector, anchor: itemselector } - - { title: layoutMode, anchor: layoutmode } - - { title: onLayout, anchor: onlayout } - - { title: resizable, anchor: resizable } - - { title: resizesContainer, anchor: resizescontainer } - - { title: sortAscending, anchor: sortascending } - - { title: sortBy, anchor: sortby } - - { title: transformsEnabled, anchor: transformsenabled } - - { title: visibleStyle, anchor: visiblestyle } - - { title: Layout-specific options, anchor: layoutspecific_options } - ---- - -
-
option
-
Type
-
Default
-
- -## animationEngine - -
-
animationEngine
-
String
-
'best-available'
-
- -Determines the jQuery method to apply styles, `.css()` or `.animate()`. Useful for relying on CSS transitions to handle animation. - -### Values {#animationEngine-values} - - -+ `'best-available'`: if browser supports CSS transitions, Isotope uses `.css()`. If not, falls back to using `.animate()`. -+ `'css'`: Isotope uses `.css()` -+ `'jquery'`: Isotope uses `.animate()` - -## animationOptions - -
-
animationOptions
-
Object
-
{ queue: false, duration: 800 }
-
- -When jQuery is the animation engine (see above), these options will be used in .animate(). See the [jQuery API for animate options](http://api.jquery.com/animate/#animate-properties-options) for details. - -### Example - -{% highlight javascript %} - -$('#container').isotope({ - animationOptions: { - duration: 750, - easing: 'linear', - queue: false - } -}); - -{% endhighlight %} - -## containerClass - -
-
containerClass
-
String
-
'isotope'
-
- -The class applied to the container element. - -## containerStyle - -
-
containerStyle
-
Object
-
{ position: 'relative', overflow: 'hidden' }
-
- -CSS styles applied to the container element. Relative positioning enables absolute positioning on child items. Hidden overflow ensures that filtered items that lie outside the container do not interfer with subsequent content. - -## filter - -
-
filter
-
Selector
-
- -Setting a filter with show item elements that match the selector, and hide elements that do not match. See [docs on filering](filtering.html) for more details. - -[**See Demo: Filtering**](../demos/filtering.html) - -### Values {#filter-values} - - - - - -## getSortData - -
-
getSortData
-
Object
-
- -An object containing one or several methods to retrieve data for Sorting. The methods receive one parameter (`$elem` in the example below) which is a jQuery object representing each item element. The methods need to return a value. See [docs on sorting](sorting.html) for more details. - -[**See Demo: Sorting**](../demos/sorting.html) - -### Example - -{% highlight javascript %} - -$('#container').isotope({ - getSortData : { - symbol : function( $elem ) { - return $elem.attr('data-symbol'); - }, - number : function( $elem ) { - return parseInt( $elem.find('.number').text(), 10 ); - }, - name : function ( $elem ) { - return $elem.find('.name').text(); - } - } -}); - -{% endhighlight %} - -## hiddenClass - -
-
hiddenClass
-
String
-
'isotope-hidden'
-
- -The class applied to item elements hidden by Filtering. - -## hiddenStyle - -
-
hiddenStyle
-
Object
-
{ opacity : 0, scale : 0.001 }
-
- -The style applied to item elements hidden by Filtering. - -## itemClass - -
-
itemClass
-
String
-
'isotope-item'
-
- -The class applied to item elements. - -## itemPositionDataEnabled - -
-
itemPositionDataEnabled
-
Boolean
-
false
-
- -When enabled, the position of item elements will exposed as data, which you can retrieve with jQuery's data method with 'isotope-item-position' name space. Position is return as an object with `x` and `y`; - -### Example - -{% highlight javascript %} - -$('#container').isotope({ - itemSelector: '.element', - itemPositionDataEnabled: true -}) -// log position of each item -.find('.element').each(function(){ - var position = $(this).data('isotope-item-position'); - console.log('item position is x: ' + position.x + ', y: ' + position.y ); -}); - -{% endhighlight %} - -## itemSelector - -
-
itemSelector
-
Selector
-
- -Restricts Isotope item elements to selector. - -## layoutMode - -
-
layoutMode
-
String
-
'masonry'
-
- -See also docs on [Layout modes](layout-modes.html). - -[**See Demo: Layout modes**](../demos/layout-modes.html) - -## onLayout - -
-
onLayout
-
Function
-
- -Similiar to a callback, `onLayout` is a function that will be triggered after every time an Isotope instance runs through its layout logic. - -{% highlight javascript %} - -$('#container').isotope({ - 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 ); - } -}); - -{% endhighlight %} - -## resizable - -
-
resizable
-
Boolean
-
true
-
- -Triggers layout logic when browser window is resized. - -## resizesContainer - -
-
resizesContainer
-
Boolean
-
true
-
- -Isotope will set the height (for vertical layout modes) or width (for horizontal layout modes) of the container after layout. If `resizesContainer` is set to false, be sure to set a size for the container in your CSS, so it doesn't collapse when Isotope is triggered. - -## sortAscending - -
-
sortAscending
-
Boolean
-
true
-
- -Used with sorting. If true, items are sorted ascending: "1, 2, 3" or "A, B, C...". If false, items are sorted descending "Z, Y, X" or "9, 8, 7...". See [docs on sorting](sorting.html) for more details. - -[**See Demo: Sorting**](../demos/sorting.html) - -## sortBy - -
-
sortBy
-
String
-
- -The property name of the method within the `getSortData` option to sort item elements. See [docs on sorting](sorting.html) for more details. - -[**See Demo: Sorting**](../demos/sorting.html) - -### Values {#sortBy-values} - -+ `'original-order'` Sorts item elements by their original order. - -## transformsEnabled - -
-
transformsEnabled
-
Boolean
-
true
-
- -Isotope uses CSS3 transforms to position item elements, when available in the browser. Setting `transformsEnabled` to false will disable this feature so all browsers use top/left absolute positioning. Useful for [resolving issues with CSS transforms](help.html#css-transforms). - -### Additional CSS {#transformsEnabled-css} - -If you do disable transforms, but still want to use [CSS transitions](animating.html#css_transitions), you'll need add the following CSS: - -{% highlight css %} - -.isotope .isotope-item { - -webkit-transition-property: top, left, opacity; - -moz-transition-property: top, left, opacity; - -ms-transition-property: top, left, opacity; - -o-transition-property: top, left, opacity; - transition-property: top, left, opacity; -} - -{% endhighlight %} - -## visibleStyle - -
-
visibleStyle
-
Object
-
{ opacity : 1, scale : 1 }
-
- -The style applied to item elements made visible by Filtering. - -## Layout-specific options - -In addition the general options listed above, certain layout modes each have their own options. In order to avoid conflict, these options are set with an option that matches the name of the layout mode. - -See docs on [layout modes](layout-modes.html) for each layout mode's available options. - -For example, if your layout switched from `masonry` to `cellsByRow`: - -{% highlight javascript %} - -$('#container').isotope({ - masonry: { - columnWidth: 120 - }, - cellsByRow: { - columnWidth: 220, - rowHeight: 220 - } -}); - -{% endhighlight %} - -[**See Demo: Layout modes**](../demos/layout-modes.html) \ No newline at end of file diff --git a/_posts/docs/2010-12-04-methods.md b/_posts/docs/2010-12-04-methods.md deleted file mode 100644 index 0d12cbf..0000000 --- a/_posts/docs/2010-12-04-methods.md +++ /dev/null @@ -1,159 +0,0 @@ ---- - -title: Methods -category: docs -layout: default -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 } - - { title: reloadItems, anchor: reloaditems } - - { title: remove, anchor: remove } - - { title: shuffle, anchor: shuffle } - - { title: updateSortData, anchor: updatesortdata } - ---- - -Isotope offers several methods to extend functionality. Isotope's methods follow the jQuery UI pattern. - -{% highlight javascript %} - -$('#container').isotope( 'methodName', [optionalParameters] ) - -{% endhighlight %} - -## addItems - -{% highlight javascript %} - -.isotope( 'addItems', $items, callback ) - -{% endhighlight %} - -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. - -[**See Demo: Adding items**](../demos/adding-items.html) - -## appended - -{% highlight javascript %} - -.isotope( 'appended', $items, callback ) - -{% endhighlight %} - -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. - -[**See Demo: Adding items**](../demos/adding-items.html) - -## destroy - -{% highlight javascript %} - -.isotope( 'destroy' ) - -{% endhighlight %} - -Removes Isotope functionality completely. Returns element back to pre-init state. - -## insert - -{% highlight javascript %} - -.isotope( 'insert', $items, callback ) - -{% endhighlight %} - -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. - -[**See Demo: Adding items**](../demos/adding-items.html). - -## layout - -{% highlight javascript %} - -.isotope( 'layout', $items, callback ) - -{% endhighlight %} - -Positions specified item elements in layout. - -`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. - -## option - -{% highlight javascript %} - -.isotope( 'option', options ) - -{% endhighlight %} - -Sets options for plugin instance. Unlike passing options through `.isotope()`, using the `option` method will not trigger layout. - -{% highlight javascript %} - -// sets multiple options -.isotope( 'option', { layoutMode: 'fitRows', filter: '.my-filter' } ) - -{% endhighlight %} - - -## reLayout - -{% highlight javascript %} - -.isotope( 'reLayout', callback ) - -{% endhighlight %} - -Resets layout properties and lays-out every item element. - -[**See Demo: reLayout**](../demos/relayout.html) - -## 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). - -## remove - -{% highlight javascript %} - -.isotope( 'remove', $items, callback ) - -{% endhighlight %} - -Removes specified item elements from Isotope widget and the DOM. - -[**See Demo: Removing**](../demos/removing.html). - -## shuffle - -{% highlight javascript %} - -.isotope( 'shuffle', callback ) - -{% endhighlight %} - -Shuffles order of items. Sets [`sortBy` option](options.html#sortby) to [`'random'`](sorting.html#sortby_option). - -## 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. diff --git a/_posts/docs/2010-12-05-layout-modes.md b/_posts/docs/2010-12-05-layout-modes.md deleted file mode 100644 index d0de3db..0000000 --- a/_posts/docs/2010-12-05-layout-modes.md +++ /dev/null @@ -1,191 +0,0 @@ ---- - -title: Layout modes -category: docs -layout: default -body_class: option-def -toc: - - { title: Horizontal layouts, anchor: horizontal_layouts } - - { title: cellsByColumn, anchor: cellsbycolumn } - - { title: cellsByRow, anchor: cellsbyrow } - - { title: fitColumns, anchor: fitcolumns } - - { title: fitRows, anchor: fitrows } - - { title: masonry, anchor: masonry } - - { title: masonryHorizontal, anchor: masonryhorizontal } - - { title: straightAcross, anchor: straightacross } - - { title: straightDown, anchor: straightdown } - - { title: Modified layout modes, anchor: modified_layout_modes } - ---- - -Isotope has a versatile layout engine that can accommodate multiple layout modes. You can set and change the layout mode via the `layoutMode` option. - -[**See Demo: Layout modes**](../demos/layout-modes.html) - -### Example - -{% highlight javascript %} - -$('#container').isotope({ layoutMode : 'fitRows' }); - -{% endhighlight %} - -Several layout modes are built into Isotope. - -### Horizontal layouts - -Horizontal layout modes (masonryHorizontal, fitColumns, cellsByColumn, and straightAcross) need a container that has a height value. Be sure that your CSS has height set. - -{% highlight css %} - -#container { - /* either of these will work for horizontal Isotope layouts */ - height: 80%; - height: 480px; -} - -{% endhighlight %} - -## cellsByColumn - -A **horizontal** grid layout where items are centered inside each cell. The grid is defined by two options, `columnWidth` and `rowHeight`. The horizontal equivalent of cellsByRow. - -### Options {#cellsByColumn-options} - -
-
columnWidth
-
Integer
-
-
-
rowHeight
-
Integer
-
- -### Example {#cellsByColumn-example} - -{% highlight javascript %} - -$('#container').isotope({ - layoutMode: 'cellsByColumn', - cellsByColumn: { - columnWidth: 240, - rowHeight: 360 - } -}); - -{% endhighlight %} - - -## cellsByRow - -A **vertical** grid layout where items are centered inside each cell. The grid is defined by two options, `columnWidth` and `rowHeight`. - -### Options {#cellsByRow-options} - -
-
columnWidth
-
Integer
-
-
-
rowHeight
-
Integer
-
- -### Example {#cellsByRow-example} - -{% highlight javascript %} - -$('#container').isotope({ - layoutMode: 'cellsByRow', - cellsByRow: { - columnWidth: 240, - rowHeight: 360 - } -}); - -{% endhighlight %} - -## fitColumns - -Item elements are arranged into columns. Columns progress **horizontally** from left to right. Items within those columns are arranged top-to-bottom. The horizontal equivalent of fitRows. - -## fitRows - -Item elements are arranged into rows. Rows progress **vertically** top to bottom. Similar to what you would expect from a layout that uses `float: left`. - -## masonry - -Masonry is the default layout mode for Isotope. Item elements are arranged intelligently within a **vertical** grid. For each item element, the script calculates the next best fit for the item within the grid. - -### Options {#masonry-options} - -
-
columnWidth
-
Integer
-
- -The width of one column in the grid. If no value is set for `columnWidth`, default is the width of the first item element. - -### Example {#masonry-example} - -{% highlight javascript %} - -$('#container').isotope({ - masonry: { - columnWidth: 240 - } -}); - -{% endhighlight %} - - -## masonryHorizontal - -The **horizontal** equivalent of masonry layout. Instead of progressing top-to-bottom, masonryHorizontal layout will progress left-to-right. Item elements are arranged intelligently within a grid. For each item element, the script calculates the next best fit for the item within the grid. - -### Options {#masonryHorizontal-options} - -
-
rowHeight
-
Integer
-
- -The width of one column in the grid. If no value is set for `rowHeight`, default is the height of the first item element. - -### Example {#masonryHorizontal-example} - -{% highlight javascript %} - -$('#container').isotope({ - masonryHorizontal: { - rowHeight: 360 - } -}); - -{% endhighlight %} - -## straightAcross - -Item elements are arranged **horizontally** left to right. Useful for simple lists. - -## straightDown - -Item elements are arranged **vertically** top to bottom. Useful for simple lists. - -## Modified layout modes - -[Isotope's methods can be extended and overwritten](extending-isotope.html) to shim-in additional functionality. See these modified layout modes: - -+ [**Centered masonry**](../custom-layout-modes/centered-masonry.html) -+ [**Masonry corner stamp**](../custom-layout-modes/masonry-corner-stamp.html) -+ [**Masonry gutters**](../custom-layout-modes/masonry-gutters.html) - -To use these mods, copy the revised methods found in the demos' page source. They look like: - -{% highlight javascript %} - -$.Isotope.prototype._masonryReset = function() { - // modified code.. -}; - -{% endhighlight %} diff --git a/_posts/docs/2010-12-06-filtering.md b/_posts/docs/2010-12-06-filtering.md deleted file mode 100644 index bb14ba9..0000000 --- a/_posts/docs/2010-12-06-filtering.md +++ /dev/null @@ -1,109 +0,0 @@ ---- - -title: Filtering -category: docs -layout: default -toc: - - { title: Markup, anchor: markup } - - { title: jQuery script, anchor: jquery_script } - - { title: Creating interactive buttons, anchor: creating_interactive_buttons } - - { title: Recommended CSS, anchor: recommended_css } - ---- - -Isotope can hide and show item elements via the [`filter` option](options.html#filter). `filter` accepts a jQuery selector. Items that match that selector will be shown. Items that do not match will be hidden. - -[**See Demo: Filtering**](../demos/filtering.html) - -## Markup - -Each item element has several identifying classes. In this case, `transition`, `metal`, `lanthanoid`, `alkali`, etc. - -{% highlight html %} - -
-
...
-
...
-
...
-
...
-
...
-
...
-
...
- ... -
- -{% endhighlight %} - -## jQuery script - -To show only `.metal` items, the jQuery script would be: - -{% highlight javascript %} - -$('#container').isotope({ filter: '.metal' }); - -{% endhighlight %} - -The `filter` option uses a [jQuery selector](http://api.jquery.com/category/selectors/) to show item elements that match a selector, and hide all others that do not. For example: - -+ `.alkali, .alkaline-earth` will show `.alkali` AND ` .alkaline-earth` item elements. -+ `.metal.transition` will show item elements that have BOTH `.metal` and `.transition` classes. -+ `.metal:not(.transition)` will show `.metal` item elements that are NOT `.transition`. - -## Creating interactive buttons - -Let's use a basic list for our buttons - -{% highlight html %} - - - -{% endhighlight %} - -Here we set the filter for each link with a `data-filter` attribute. In our jQuery script, whenever a link is clicked, we'll use this attribute as the filter selector. - -{% highlight javascript %} - -// cache container -var $container = $('#container'); -// initialize isotope -$container.isotope({ - // options... -}); - -// filter items when filter link is clicked -$('#filters a').click(function(){ - var selector = $(this).attr('data-filter'); - $container.isotope({ filter: selector }); - return false; -}); - -{% endhighlight %} - -## Recommended CSS - -If you choose to use the filtering functionality, add the following CSS to your stylesheet: - -{% highlight css %} - -/**** Isotope filtering ****/ - -.isotope-item { - z-index: 2; -} - -.isotope-hidden.isotope-item { - pointer-events: none; - z-index: 1; -} - -{% endhighlight %} - -These styles ensure that hidden items will not interfere with interactions. diff --git a/_posts/docs/2010-12-07-sorting.md b/_posts/docs/2010-12-07-sorting.md deleted file mode 100644 index 7e2aceb..0000000 --- a/_posts/docs/2010-12-07-sorting.md +++ /dev/null @@ -1,169 +0,0 @@ ---- - -title: Sorting -category: docs -layout: default -toc: - - { title: Markup, anchor: markup } - - { title: getSortData option, anchor: getsortdata_option } - - { title: sortBy option, anchor: sortby_option } - - { title: sortAscending option, anchor: sortascending_option } - - { title: Creating interactive buttons, anchor: creating_interactive_buttons } - ---- - -Collect data from item element and rearrange their order in the layout with sorting. - -[**See Demo: Sorting**](../demos/sorting.html) - -## Markup - -Any group of similar items have their own data. It could be a text value, like a title or tag, or a numerical value, like a measurement or grade. For our example, each item element has several data points that can be used for sorting. There's the elemental symbol, number, name of the element, weight, and category. - -{% highlight html %} - -
-
-

79

-

Au

-

Gold

-

196.966569

-
- -
-

51

-

Sb

-

Antimony

-

121.76

-
-
- -{% endhighlight %} - - -## getSortData option - -In order to extract this data from the element, we need to pass in a function to get it via the [`getSortData`](options.html#getsortdata) option. This option accepts an object, whose values are the functions to extract the data. - -Each function receives one argument, which represents a jQuery object for each item element. With that argument, the function needs to return the data point. - -In the example above, to get element name, we would need to get the text from the `.name` element. The same works for symbol. - -{% highlight javascript %} - -$('#container').isotope({ - getSortData : { - name : function ( $elem ) { - return $elem.find('.name').text(); - }, - symbol : function ( $elem ) { - return $elem.find('.symbol').text(); - } - } -}); - -{% endhighlight %} - - -For numerical data, we can convert a text value into a number with `parseInt()` or `parseFloat()`. - -{% highlight javascript %} - -getSortData : { - // ... - number : function ( $elem ) { - return parseInt( $elem.find('.number').text(), 10 ); - }, - weight : function ( $elem ) { - return parseFloat( $elem.find('.weight').text() ); - } -} - -{% endhighlight %} - -The data extracted can be anything accessible in the item element via jQuery. To extract the category data held within the `data-category` attribute, we can use the `.attr()`. - -{% highlight javascript %} - -getSortData : { - // ... - category : function ( $elem ) { - return $elem.attr('data-category'); - } -} - -{% endhighlight %} - -Get creative! You could sort a list by the width of each item element. - -{% highlight javascript %} - -getSortData : { - // ... - width : function( $elem ) { - return $elem.width(); - } -} - -{% endhighlight %} - -## sortBy option - -For every method set in `getSortData`, Isotope uses that method to build the data for sorting. The data cache is built on initialization so it can be quickly accessed when sorting. With the methods above, we have built data for an item elements name, symbol, number, weight and category. - -Sorting elements is done with the [`sortBy` option](options.html#sortby). The value needs to match the property name used in the `getSortData` object. - -With our example, we can use `'name'`, `'symbol'`, `'number'`, `'weight'` and `'category'`. - -{% highlight javascript %} - -$('#container').isotope({ sortBy : 'symbol' }); - -{% endhighlight %} - -There are two additional sorting data methods built in to Isotope. - -+ `'original-order'` will use the original order of the item elements to arrange them in the layout. -+ `'random'` is a random order. - -## sortAscending option - -By default, Isotope sorts data in ascension. If our data for name is "Gold, Antimony, Lead, Iron, Silver", when sorted by name, the elements will be ordered ABC.. : "Antimony, Gold, Iron, Lead, Silver." To reverse the order and sort data in descension, set [`sortAscending`](options.html#sortascending) to false. - -{% highlight javascript %} - -$('#container').isotope({ - sortBy : 'name', - sortAscending : false -}); - -{% endhighlight %} - -## Creating interactive buttons - -We can use a simple list for our buttons. - -{% highlight html %} - - - -{% endhighlight %} - -When one of these links is clicked, we can use the `href` attribute as the value for `sortBy` in the Isotope script. - -{% highlight javascript %} - -$('#sort-by a').click(function(){ - // get href attribute, minus the '#' - var sortName = $(this).attr('href').slice(1); - $('#container').isotope({ sortBy : sortName }); - return false; -}); - -{% endhighlight %} diff --git a/_posts/docs/2010-12-09-animating.md b/_posts/docs/2010-12-09-animating.md deleted file mode 100644 index f991ba2..0000000 --- a/_posts/docs/2010-12-09-animating.md +++ /dev/null @@ -1,100 +0,0 @@ ---- - -title: Animating -category: docs -layout: default -toc: - - { title: animationEngine option, anchor: animationengine_option } - - { title: CSS transitions, anchor: css_transitions } - - { title: Variations, anchor: variations } - ---- - -Isotope was developed to take advantage of the best browser features available. For animations, you can use CSS3 transitions and transforms in capable browsers. Isotope provides Javascript animation fall back for lesser browsers. - - -## animationEngine option - -You can control how Isotope handles animation with the [`animationEngine`](options.html#animationengine) option. This option has three values which control whether jQuery applies styles with`.css()` or `.animate()`. - -+ `'best-available'`: if browser supports CSS transitions, Isotope uses `.css()`. If not, falls back to using `.animate()`. -+ `'css'`: Isotope uses `.css()` -+ `'jquery'`: Isotope uses `.animate()` - -## CSS transitions - -To enable animation with CSS transitions, you'll need the following code in your CSS: - -{% highlight css %} - -.isotope, -.isotope .isotope-item { - /* change duration value to whatever you like */ - -webkit-transition-duration: 0.8s; - -moz-transition-duration: 0.8s; - -ms-transition-duration: 0.8s; - -o-transition-duration: 0.8s; - transition-duration: 0.8s; -} - -.isotope { - -webkit-transition-property: height, width; - -moz-transition-property: height, width; - -ms-transition-property: height, width; - -o-transition-property: height, width; - transition-property: height, width; -} - -.isotope .isotope-item { - -webkit-transition-property: -webkit-transform, opacity; - -moz-transition-property: -moz-transform, opacity; - -ms-transition-property: -ms-transform, opacity; - -o-transition-property: -o-transform, opacity; - transition-property: transform, opacity; -} - -/**** disabling Isotope CSS3 transitions ****/ - -.isotope.no-transition, -.isotope.no-transition .isotope-item, -.isotope .isotope-item.no-transition { - -webkit-transition-duration: 0s; - -moz-transition-duration: 0s; - -ms-transition-duration: 0s; - -o-transition-duration: 0s; - transition-duration: 0s; -} - -{% endhighlight %} - -## Variations - -With these two options you can finely control how animation is handled across browsers. - -### Best available (recommended) - -Browsers that support CSS transitions will use them. Other browsers will fall back to using jQuery animation. - -+ **Add** CSS transition declarations - -### Always use jQuery - -All browsers will use jQuery animation, regardless of their CSS transition support. - -+ `animationEngine : 'jquery'` -+ **No** CSS transition declarations - -Never set `animationEngine : 'jquery'` AND add CSS transition declarations. This will cause double-animation in browser that support CSS transitions — which is a bad thing. - -### Only CSS transitions - -+ `animationEngine: 'css'` -+ **Add** CSS transition declarations - -### None - -Animation is not enabled in any browser - -+ `animationEngine : 'css'` -+ **No** CSS transition declarations - diff --git a/_posts/docs/2010-12-10-adding-items.md b/_posts/docs/2010-12-10-adding-items.md deleted file mode 100644 index f74af8f..0000000 --- a/_posts/docs/2010-12-10-adding-items.md +++ /dev/null @@ -1,79 +0,0 @@ ---- - -title: Adding items -category: docs -layout: default -toc: - - { title: addItems method, anchor: additems_method } - - { title: insert method, anchor: insert_method } - - { title: appended method, anchor: appended_method } - - { title: Prepending, anchor: prepending } - - { title: Recommended CSS, anchor: recommended_css } - ---- - -If your application dynamically adds new content, Isotope provides several methods to add items. - -[**See Demo: Adding items**](../demos/adding-items.html). - -## addItems method - -The [`addItems` method](methods.html#additems) adds new content to an Isotope container. This applies the proper styles to the items so they can be positioned and any sorting data is retrieved. But that's it. The new content will _not_ be filtered, sorted, or positioned properly, nor will it be appended to the container element. - -{% highlight javascript %} - -var $newItems = $('
'); -$('#container').append( $newItems ).isotope( 'addItems', $newItems ); - -{% endhighlight %} - -## insert method - -More likely, you want to use the [`insert` method](methods.html#insert), which does everything that `addItems` misses. `insert` will append the content to the container, filter the new content, sort all the content, then trigger a `reLayout` so all item elements are properly laid out. - -{% highlight javascript %} - -var $newItems = $('
'); -$('#container').isotope( 'insert', $newItems ); - -{% endhighlight %} - -## appended method - -The [`appended` method](methods.html#appended) is a convenience method triggers `addItems` on new content, then lays out _only the new content_ at the end of the layout. This method is useful if you know you only want to add new content to the end, and **not** use filtering or sorting. `appended` is the best method to use with Infinite Scroll. - -[**See Demo: Infinite Scroll**](../demos/infinite-scroll.html). - -See also [Infinite Scroll with filtering or sorting](help.html#infinite_scroll_with_filtering_or_sorting) - -## Prepending - -Because of Isotope's sorting functionality, prepending isn't as straight forward as might expect. However, it can be replicated fairly easy. After prepending new content to the container, you can re-collect all the item elements and update their sorting order with the [`reloadItems` method](methods.html#reloaditems). Then trigger a re-layout, with the original DOM order. - -{% highlight javascript %} - -var $newItems = $('
'); -$('#container').prepend( $newItems) - .isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); - -{% endhighlight %} - -## Recommended CSS - -You'll need these styles in your CSS for the reveal animation when adding items. - -{% highlight css %} - -/**** disabling Isotope CSS3 transitions ****/ - -.isotope.no-transition, -.isotope.no-transition .isotope-item, -.isotope .isotope-item.no-transition { - -webkit-transition-duration: 0s; - -moz-transition-duration: 0s; - -ms-transition-duration: 0s; - -o-transition-duration: 0s; - transition-duration: 0s; -} - -{% endhighlight %} diff --git a/_posts/docs/2011-05-25-extending-isotope.md b/_posts/docs/2011-05-25-extending-isotope.md deleted file mode 100644 index 082ed50..0000000 --- a/_posts/docs/2011-05-25-extending-isotope.md +++ /dev/null @@ -1,174 +0,0 @@ ---- - -title: Extending Isotope -category: docs -layout: default -toc: - - { title: Custom layout modes, anchor: custom_layout_modes } - ---- - -Isotope uses a constructor pattern, `$.Isotope`. To extend Isotope, you need only to add a method to `$.Isotope.prototype`. - -{% highlight javascript %} - -$.Isotope.prototype.myMethod = function() { ... }; - -// or, using jQuery extend utility -$.extend( $.Isotope.prototype, { - myMethod : function() { ... } -}); - -{% endhighlight %} - -Before diving in, try [looking over the source](../jquery.isotope.js) to get a better understand of the internal logic behind Isotope. - -## Custom layout modes - -Isotope's layout modes are built around four methods: `Reset`, `Layout`, `GetContainerSize`, and `ResizeChanged`. These methods are the hooks that allow you to develop your own custom layout mode, without getting your hands dirty dealing with sorting, filtering, or other functionality. These layout mode methods need to be prefixed with an underscore and the name of the layout mode. - -{% highlight javascript %} - -// adding layout mode methods for 'customMode' -$.extend( $.Isotope.prototype, { - _customModeReset : function() { ... }, - _customModeLayout : function( $elems ) { ... }, - _customModeGetContainerSize : function() { ... }, - _customModeResizeChanged : function() { ... } -}); - -{% endhighlight %} - -[**See Custom layout mode: Category Rows**](../custom-layout-modes/category-rows.html) -[**See Custom layout mode: Spine align**](../custom-layout-modes/spine-align.html) - -All of the [default layout modes](../docs/layout-modes.html) follow this pattern. We'll look at the code behind the _fitRows_ layout mode. - -### Reset - -Each layout mode should have its own set of properties that only it can use and not be affected by other layout modes. These properties can be accessed in the instance as an object whose value matches the layout mode name (i.e. `this.fitRows` for _fitRows_). - -The `Reset` layout mode method is called with every `reLayout`, where Isotope will go through each item element and position it. This method resets layout mode properties. - -The _fitRows_ layout mode keeps track of x and y position, as well as the height of the container. These properties are set back to zero in `Reset`. - -{% highlight javascript %} - -_fitRowsReset : function() { - this.fitRows = { - x : 0, - y : 0, - height : 0 - }; -}, - -{% endhighlight %} - -### Layout - -The `Layout` layout mode method is where items are positioned. Most of your layout logic happens here. This method provides one argument `$elems` -- a jQuery object with the item elements that need to be positioned. - -`$elems.each` is the principle loop, iterating over each item element and positioning it. Items are positioned with the `_pushPosition` method (see below). The layout modes properties are - -For _fitRows_, items are placed with the `this.fitRows.x` and `this.fitRows.y` values. This position is determined by if the item can fit in the current row, or if a new row needs to be started. - -{% highlight javascript %} - -_fitRowsLayout : function( $elems ) { - var instance = this, - containerWidth = this.element.width(), - props = this.fitRows; - - $elems.each( function() { - var $this = $(this), - atomW = $this.outerWidth(true), - atomH = $this.outerHeight(true); - - if ( props.x !== 0 && atomW + props.x > containerWidth ) { - // if this element cannot fit in the current row - props.x = 0; - props.y = props.height; - } - - // position the atom - instance._pushPosition( $this, props.x, props.y ); - - props.height = Math.max( props.y + atomH, props.height ); - props.x += atomW; - - }); -}, - -{% endhighlight %} - -### GetContainerSize - -After the script goes through positioning each item, it needs to resize the container. `GetContainerSize` returns the style for the size of the container. - -In _fitRows_, the height property is returned as the value for height. - -{% highlight javascript %} - -_fitRowsGetContainerSize : function () { - return { height : this.fitRows.height }; -}, - -{% endhighlight %} - -### ResizeChanged - -`ResizeChanged` is triggered whenever the browser window is resized. Before Isotope adjusts the layout, this method is triggered to determine if the layout has actually changed. The methods return a boolean. - -{% highlight javascript %} - -_fitRowsResizeChanged : function() { - return true; -}, - -{% endhighlight %} - -### Helper methods - -The `_pushPosition` method is used within a layout mode's `Layout` method. It takes 3 arguments: the item element currently being positioned, the x position, and the y position. - -{% highlight javascript %} - -_pushPosition( $item, x, y ) - -{% endhighlight %} - -`_getSegments` is used within the layout mode's `Reset` method. It performs several utilities: - -+ Determines the `columnWidth` for the layout mode (`rowHeight` for horizontal layout modes). This is either passed in as an option (i.e. `masonry { columnWidth: 90 }`), or the width of the first item element. This property is then set for the layout mode, i.e. `this.masonry.columnWidth`. -+ Calculates the number of number of columns (or rows, if horizontal) given the size of the container. This property is then set for the layout mode, i.e. `this.masonry.cols`. - -{% highlight javascript %} - -_getSegments( isHorizontal ) - -// for example -_cellsByRowReset : function() { - this.cellsByRow = { - index : 0 - }; - // get this.cellsByRow.columnWidth - this._getSegments(); - // get this.cellsByRow.rowHeight - this._getSegments(true); -}, - -{% endhighlight %} - -Similarly, `_checkIfSegmentsChanged` is used within `ResizeChanged`. It returns a boolean indicating whether or not the number of columns or rows has changed since the window has been resized. - -{% highlight javascript %} - -_checkIfSegmentsChanged( isHorizontal ) - -// for example -_masonryResizeChanged : function() { - return this._checkIfSegmentsChanged(); -}, - -{% endhighlight %} - diff --git a/_posts/docs/2011-06-16-hash-history-jquery-bbq.md b/_posts/docs/2011-06-16-hash-history-jquery-bbq.md deleted file mode 100644 index 04375bd..0000000 --- a/_posts/docs/2011-06-16-hash-history-jquery-bbq.md +++ /dev/null @@ -1,86 +0,0 @@ ---- - -title: Hash history with jQuery BBQ -category: docs -layout: default -toc: - - { title: Markup, anchor: markup } - - { title: jQuery script, anchor: jquery_script } - ---- - -As cool as Isotope is, the only thing that could make it even cooler would be adding bookmark-able URL hashes. Ben Alman's [jQuery BBQ](http://benalman.com/projects/jquery-bbq-plugin/) allows us to do just that. - -> jQuery BBQ leverages the HTML5 hashchange event to allow simple, yet powerful bookmarkable #hash history. - -[**See Demo: Hash history**](../demos/hash-history.html) - -BBQ is a marvelous plugin that provides for a lot more functionality. The [hash history demo](../demos/hash-history.html) uses multiple options (`sortBy`, `sortAscending`, and `layoutMode` in addition to `filter`), the ability to use back-button history, and properly highlights selected links. - -Given BBQ's tremendous capabilities, the code can grow to be a bit complex. Be sure to read through [BBQ's docs](http://benalman.com/code/projects/jquery-bbq/docs/files/jquery-ba-bbq-js.html) and take look at [its examples](http://benalman.com/code/projects/jquery-bbq/examples/) before you dive in and code up your own solution. - -## Markup - -Instead of setting the option values and keys with `data` attributes, we can add the option in the `href` for each link. - -{% highlight html %} - - - -{% endhighlight %} - -The `href` value is a serialized string, suitable for a URL. These values can be created with [jQuery.param()](http://api.jquery.com/jQuery.param/). - -{% highlight javascript %} - -$.param({ filter: '.metal' }) -// >> "filter=.metal" -$.param({ filter: '.alkali, alkaline-earth' }) -// >> "filter=.alkali%2C+alkaline-earth" -$.param({ filter: ':not(.transition)' }) -// >> "#filter=%3Anot(.transition)" - -{% endhighlight %} - -## jQuery script - -These serialized `href` values can be converted into their proper jQuery object form when clicked using [jQuery.deparam()](http://benalman.com/code/projects/jquery-bbq/docs/files/jquery-ba-bbq-js.html#jQuery.deparam) from jQuery BBQ. - -{% highlight javascript %} - -$('.option-set a').click(function(){ - // get href attr, remove leading # - var href = $(this).attr('href').replace( /^#/, '' ), - // convert href into object - // i.e. 'filter=.inner-transition' -> { filter: '.inner-transition' } - option = $.deparam( href, true ); - // set hash, triggers hashchange on window - $.bbq.pushState( option ); - return false; -}); - -{% endhighlight %} - -Calling [$.bbq.pushState()](http://benalman.com/code/projects/jquery-bbq/docs/files/jquery-ba-bbq-js.html#jQuery.bbq.pushState) will trigger the `hashchange` event. At that point, we can parse the hash from the URL and use it to trigger the proper change in the Isotope instance. - -{% highlight javascript %} - -$(window).bind( 'hashchange', function( event ){ - // get options object from hash - var hashOptions = $.deparam.fragment(); - // apply options from hash - $container.isotope( hashOptions ); -}) - // trigger hashchange to capture any hash data on init - .trigger('hashchange'); - -{% endhighlight %} - -Now any filter buttons that are clicked will update the URL hash, so these options can be bookmarked. diff --git a/_posts/docs/2011-12-11-help.md b/_posts/docs/2011-12-11-help.md deleted file mode 100644 index 79adc07..0000000 --- a/_posts/docs/2011-12-11-help.md +++ /dev/null @@ -1,234 +0,0 @@ ---- - -title: Help -category: docs -layout: default -toc: - - { title: Reporting bugs and issues, anchor: reporting_bugs_and_issues } - - { title: Additional resources, anchor: additional_resources } - - { title: Unloaded media, anchor: unloaded_media } - - { title: Images, anchor: images } - - { title: font-face fonts, anchor: fontface_fonts } - - { title: Problems with CSS transforms, anchor: css-transforms } - - { title: Getting item position, anchor: getting_item_position } - - { title: Accessing the instance, anchor: accessing_the_instance } - - { 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: Poor type rendering in WebKit, anchor: poor_type_rendering_in_webkit } - - { title: First item breaks Masonry layout, anchor: first_item_breaks_masonry_layout } - - { title: Right-to-left layouts, anchor: righttoleft_layouts } - - { title: Preventing clicks on filtered items, anchor: unclickable-filtered } - ---- - - -## Reporting bugs and issues - -Please read my [Issues Agreement](https://github.com/desandro/issues-agreement/#readme) and then [report bugs and issues on GitHub](http://github.com/desandro/isotope/issues). - -## Support - -Need help with getting Isotope up and running? Got a time-consuming problem you want to get solved quickly? Get [Isotope support on CodersClan](http://codersclan.net/?repo_id=1). - -

- -## Additional resources - -+ The [Metafizzy blog](http://metafizzy.co/blog/) has posts that cover specialized use cases -+ [Various Isotope tests on jsFiddle](http://www.delicious.com/desandro/re:isotope+fiddle) -+ [My answers on Stack Overflow](http://stackoverflow.com/users/182183/desandro?tab=answers) -+ [Sites using Isotope on Zootool](http://zootool.com/user/desandro/tag:isotope), has screenshots -+ [Sites using Isotope on Delicious](http://www.delicious.com/desandro/using:isotope) -+ [Miscelleanous Isotope content](http://www.delicious.com/desandro/re:isotope) - -## Unloaded media - -Most layout modes (i.e masonry, fitRows) need to measure the size of each item to appropriately account for its space in the layout. Unloaded media files like images and @font-face fonts can throw off layout and cause item elements to overlap one another. Ideally, Isotope layouts should be initialized after all inner content has loaded. - -## Images - -### Inline dimensions - -For images, the best method is to specify the width and height of images inline. - -{% highlight html %} - - - -{% endhighlight %} - -If you’re using a PHP-based CMS, you can use the [getimagesize](http://php.net/manual/en/function.getimagesize.php) function. - -### imagesLoaded plugin - -The next best solution is to use the [imagesLoaded plugin](https://github.com/desandro/imagesloaded) included with Isotope. It's a small plugin that finds all the images in a context, and fires a callback function once all the images have loaded. - -{% highlight javascript %} - -var $container = $('#container'); - -$container.imagesLoaded( function(){ - $container.isotope({ - // options... - }); -}); - -{% endhighlight %} - -### `$(window).load()` - -Another solution is to initialize Isotope inside `$(window).load()` instead of `$(document).ready()`. This will trigger Isotope after all the media on the page has loaded. - -{% highlight javascript %} - -$(window).load(function(){ - $('#container').isotope({ - // options... - }); -}); - -{% endhighlight %} - -## @font-face fonts - -Both Typekit and Google WebFont Loader provide font events to control scripts based on how fonts are loaded. - -+ [Typekit font events](http://blog.typekit.com/2010/10/18/more-control-with-typekits-font-events/) -+ [Google WebFont Loader: Events](http://code.google.com/apis/webfonts/docs/webfont_loader.html#Events) - -## Problems with CSS transforms {: #css-transforms} - -As the browser implementations of CSS tranforms are still a work-in-progress, they can cause buggy behavoir with other types of dynamic content. - -
- -+ [Flash content in Safari and Firefox](http://dropshado.ws/post/4085720152/css-transforms-breaking-flash), like YouTube or Vimeo videos, Flash ads, or Flash audio players. - -### Disabling transforms - -Set [`transformsEnabled`](options.html#transformsenabled) to `false`. This is an easy step to take when troubleshooting. - -{% highlight javascript %} - -$('#container').isotope({ - // options... - transformsEnabled: false -}); - -{% endhighlight %} - -## Getting item position - -CSS transforms will break previous patterns for getting the position of an item. See the [`itemPositionDataEnabled`](options.html#itempositiondataenabled) option for a stop-gap. - -## Accessing the instance - -[Similar to jQuery UI](http://docs.jquery.com/UI_Developer_Guide#Internal_functions_.26_scopes_explained), Isotope stores a instance containing properties, settings and methods with jQuery.data. You can access the instance with the `'isotope'` namespace. - -{% highlight javascript %} - -var $container = $('#container'); - -// initialize Isotope instance -$container.isotope({ - // options... -}); - -// get Isotope instance -var isotopeInstance = $container.data('isotope'); -isotopeInstance.options; // options -isotopeInstance.$filteredAtoms; // jQuery object of filtered & sorted item elements -isotopeInstance.masonry.columnWidth; // Layout mode specific properties - -{% endhighlight %} - -## CSS transforms in Opera - -[Using CSS transforms in older versions Opera (< 12) distorts text rendering](http://dropshado.ws/post/1260101028/opera-transform-issues). See how to enable [CSS transitions with top, left positioning](options.html#transformsEnabled-css). - -## Infinite Scroll with filtering or sorting - -I recommend against using Infinite Scroll with filtering or sorting. This combination produces a unnecessarily complex user interaction that will frustrate your users. New content gets added, but part of it might be hidden. There is no way for the user to tell what gets hidden or re-arranged when Infinite Scroll adds more content. Exercise [moderation](introduction.html#moderation) with your Isotope implementation. - -If you do plan on implementing Infinite Scroll with filtering or sorting (which is a _bad idea_), use the `insert` method instead of `appended`. - -## Poor type rendering in WebKit - -Type rendering may appear poor in WebKit browsers like Chrome and Safari. This is because of Isotope's activation of hardware acceleration. A solution is to add add a matching background to the item elements. See more: [dropshado.ws - Resolving anti-aliasing on WebKit hardware-accelerated elements](http://dropshado.ws/post/6142339613/resolving-anti-aliasing-on-webkit-hardware-accelerated). Another solution is to [disable transforms](#disabling_transforms). - -## First item breaks Masonry layout - -With [Masonry layout mode](layout-modes.html#masonry) If you run into an issue where you re-size the first item, and all the rest of the items no longer fit together in the grid, you most likely need to set [`columnWidth` option](layout-modes.html#masonry-options). Without `columnWidth` set, the Masonry layout mode will use the width of the first item for the size of its columns. - -{% highlight javascript %} - -$('#container').isotope( - masonry: { - columnWidth: 220 - } -}); - -{% endhighlight %} - -## Right-to-left layouts - -Isotope can be modified to support right-to-left layouts for languages like Hebrew and Arabic. - -[**See test: Right to left**](../tests/right-to-left.html) - -You'll need to make the following changes: - -+ Modify Isotope's `_positionAbs` method -+ Set `transformsEnabled: false` in the Isotope options -+ Add CSS transition property styles for right/top. - -### JavaScript for right-to-left support - -{% highlight javascript %} - -// modify Isotope's absolute position method -$.Isotope.prototype._positionAbs = function( x, y ) { - return { right: x, top: y }; -}; - -// initialize Isotope -$('#container').isotope({ - transformsEnabled: false - // other options... -}); - -{% endhighlight %} - -### CSS for right-to-left support - -{% highlight css %} - -.isotope .isotope-item { - -webkit-transition-property: right, top, -webkit-transform, opacity; - -moz-transition-property: right, top, -moz-transform, opacity; - -ms-transition-property: right, top, -ms-transform, opacity; - -o-transition-property: right, top, -o-transform, opacity; - transition-property: right, top, transform, opacity; -} - -{% endhighlight %} - -## Preventing clicks on filtered items {: #unclickable-filtered} - -The [recommended CSS for filtering](filtering.html#recommended_css) includes `pointer-events: none` for `.isotope-hidden`. Unfortunately, Opera and Internet Explorer still let click events propagate with this style in place. But you can still dismiss click events in your click handler by checking to see if the element or element's parent is a filtered item. - -[See test: Unclickable filtered](../tests/unclickable-filtered.html) - -{% highlight javascript %} - -$('.item a').click(function(){ - var $this = $(this); - // back out if hidden item - if ( $this.parents('.isotope-item').hasClass('isotope-hidden') ) { - return; - } - // otherwise, continue to do stuff... - console.log('item was clicked'); -}); - -{% endhighlight %} \ No newline at end of file diff --git a/_posts/docs/2011-12-20-license.md b/_posts/docs/2011-12-20-license.md deleted file mode 100644 index d35d4f2..0000000 --- a/_posts/docs/2011-12-20-license.md +++ /dev/null @@ -1,79 +0,0 @@ ---- - -title: License -category: docs -layout: default -toc: - - { title: Commercial licensing, anchor: commercial_licensing } - - { title: Isotope Commercial License Agreement, anchor: isotope_commercial_license_agreement } - ---- - -Isotope may be used in commercial projects and applications with the one-time purchase of a commercial license. - -### Open source license - -For non-commercial, personal, or open source projects and applications, you may use Isotope under the terms of the MIT License. You may use Isotope for free. - -### What is commercial considered? - -If you are paid to do your job, and part of your job is implementing Isotope, a commercial license is required. - -## Commercial licensing - -Purchasing accepts most credit cards and takes seconds. Once purchased, you’ll receive a commercial license PDF and you will be all set to use Isotope in your commercial applications. - -With the purchase of a commercial license: - -+ You may use Isotope in as many commercial applications you like. -+ You may use Isotope in your own commercial applications and products. For example: premium WordPress, Tumblr, or other CMS themes, plugins and templates. -+ Customers and users of your products do **not** need to purchase their own license -- so long as they are not developing their own commercial products with Isotope. - -The commercial license comes in two varieties: - -### Isotope Commercial Developer License - -The Isotope Commercial Developer License is for individual developers. This license is priced per developer. Each individual developer needs to purchase a separate license. A developer is someone who implements Isotope, and probably types `.isotope()` at some point. - -

{% include developer-buy-button.html %}

- -### Isotope Commercial Organization License - -The Isotope Commercial Organization License is for an organization with a team of developers. The license covers the entire team no matter how many developers are working on it. - -

{% include org-buy-button.html %}

- -### Purchase via PayPal - -If you're having trouble using a credit card, try purchasing a license via PayPal: - -+ [Buy Developer License via PayPal](http://pul.ly/b/13620) -+ [Buy Organization License via PayPal](http://pul.ly/b/36595) - -## Isotope Commercial License Agreement - -This Commercial License Agreement is a binding legal agreement between you and Metafizzy LLC (**Metafizzy**). By installing, copying, or using Isotope (the **Software**), you agree to be bound by these terms of this Agreement. - -### Grant of License - -Subject to the payment of the fee required and the conditions herein, you are hereby granted a non-exclusive, non-transferable right to the Software to design and develop commercial applications (**Applications**). - -#### Developer Grant - -The Isotope Commercial Developer License grants 1 license for you as 1 designated user (**Developer**) to use the Software for the purpose of developing Applications. A Developer is an individual who implements the Software into Applications, most often writing the necessary code to do so. You must purchase another separate license to the Software for each and any additional Developer, or purchase a Isotope Commercial Organization License to cover your organization as a whole. - -#### Organization Grant - -The Isotope Commercial Organization License grants 1 license for your Organization as 1 designated, collective user (**Organization**) to use the Software for the purpose of developing Applications. There is no limit or restriction of the number of Developers within your Organization who may develop Applications using the Software. - -#### Usage - -You are granted the right to use and to modify the source code of the Software for use in Applications. There is no limit or restriction of the number of Applications which use the Software. You own any original work authored by you. Metafizzy continues to retain all copyright and other intellectual property rights in the Software. You are not permitted to move, remove, edit, or obscure any copyright, trademark, attribution, warning or disclaimer notices in the Software. - -You may use the Software only to create Applications that are significantly different than and do not compete with the Software. You are granted the license to distribute the Software as part of your Applications on a royalty-free basis. Users of your Applications are permitted to use the Software or your modifications of the Software as part of your Applications. Users do not need to purchase their own commercial license for the Software, so long as they are not acting as Developers, developing their own commercial Applications with the Software. - -### Warranties and Remedies - -The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. Metafizzy's entire liability and your exclusive remedy under this agreement shall be return of the price paid for the Software. - - diff --git a/jquery.isotope.js b/jquery.isotope.js deleted file mode 100644 index 902973b..0000000 --- a/jquery.isotope.js +++ /dev/null @@ -1,1408 +0,0 @@ -/** - * Isotope v1.5.26 - * An exquisite jQuery plugin for magical layouts - * http://isotope.metafizzy.co - * - * Commercial use requires one-time purchase of a commercial license - * http://isotope.metafizzy.co/docs/license.html - * - * Non-commercial use is licensed under the MIT License - * - * Copyright 2014 Metafizzy - */ - -/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */ -/*global jQuery: false */ - -(function( window, $, undefined ){ - - 'use strict'; - - // get global vars - var document = window.document; - var docElem = document.documentElement; - var Modernizr = window.Modernizr; - - // helper function - var capitalize = function( str ) { - return str.charAt(0).toUpperCase() + str.slice(1); - }; - - // ========================= getStyleProperty by kangax =============================== - // http://perfectionkills.com/feature-testing-css-properties/ - - var prefixes = 'Moz Webkit O Ms'.split(' '); - - var getStyleProperty = function( propName ) { - var style = docElem.style, - prefixed; - - // test standard property first - if ( typeof style[propName] === 'string' ) { - return propName; - } - - // capitalize - propName = capitalize( propName ); - - // test vendor specific properties - for ( var i=0, len = prefixes.length; i < len; i++ ) { - prefixed = prefixes[i] + propName; - if ( typeof style[ prefixed ] === 'string' ) { - return prefixed; - } - } - }; - - var transformProp = getStyleProperty('transform'), - transitionProp = getStyleProperty('transitionProperty'); - - - // ========================= miniModernizr =============================== - // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting - - /*! - * Modernizr v1.6ish: miniModernizr for Isotope - * http://www.modernizr.com - * - * Developed by: - * - Faruk Ates http://farukat.es/ - * - Paul Irish http://paulirish.com/ - * - * Copyright (c) 2009-2010 - * Dual-licensed under the BSD or MIT licenses. - * http://www.modernizr.com/license/ - */ - - /* - * This version whittles down the script just to check support for - * CSS transitions, transforms, and 3D transforms. - */ - - var tests = { - csstransforms: function() { - return !!transformProp; - }, - - csstransforms3d: function() { - var test = !!getStyleProperty('perspective'); - // double check for Chrome's false positive - if ( test && 'webkitPerspective' in docElem.style ) { - var $style = $('').appendTo('head'), - $div = $('
').appendTo('html'); - - test = $div.height() === 3; - - $div.remove(); - $style.remove(); - } - return test; - }, - - csstransitions: function() { - return !!transitionProp; - } - }; - - var testName; - - if ( Modernizr ) { - // if there's a previous Modernzir, check if there are necessary tests - for ( testName in tests) { - if ( !Modernizr.hasOwnProperty( testName ) ) { - // if test hasn't been run, use addTest to run it - Modernizr.addTest( testName, tests[ testName ] ); - } - } - } else { - // or create new mini Modernizr that just has the 3 tests - Modernizr = window.Modernizr = { - _version : '1.6ish: miniModernizr for Isotope' - }; - - var classes = ' '; - var result; - - // Run through tests - for ( testName in tests) { - result = tests[ testName ](); - Modernizr[ testName ] = result; - classes += ' ' + ( result ? '' : 'no-' ) + testName; - } - - // Add the new classes to the element. - $('html').addClass( classes ); - } - - - // ========================= isoTransform =============================== - - /** - * provides hooks for .css({ scale: value, translate: [x, y] }) - * Progressively enhanced CSS transforms - * Uses hardware accelerated 3D transforms for Safari - * or falls back to 2D transforms. - */ - - if ( Modernizr.csstransforms ) { - - // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)' - var transformFnNotations = Modernizr.csstransforms3d ? - { // 3D transform functions - translate : function ( position ) { - return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) '; - }, - scale : function ( scale ) { - return 'scale3d(' + scale + ', ' + scale + ', 1) '; - } - } : - { // 2D transform functions - translate : function ( position ) { - return 'translate(' + position[0] + 'px, ' + position[1] + 'px) '; - }, - scale : function ( scale ) { - return 'scale(' + scale + ') '; - } - } - ; - - var setIsoTransform = function ( elem, name, value ) { - // unpack current transform data - var data = $.data( elem, 'isoTransform' ) || {}, - newData = {}, - fnName, - transformObj = {}, - transformValue; - - // i.e. newData.scale = 0.5 - newData[ name ] = value; - // extend new value over current data - $.extend( data, newData ); - - for ( fnName in data ) { - transformValue = data[ fnName ]; - transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue ); - } - - // get proper order - // ideally, we could loop through this give an array, but since we only have - // a couple transforms we're keeping track of, we'll do it like so - var translateFn = transformObj.translate || '', - scaleFn = transformObj.scale || '', - // sorting so translate always comes first - valueFns = translateFn + scaleFn; - - // set data back in elem - $.data( elem, 'isoTransform', data ); - - // set name to vendor specific property - elem.style[ transformProp ] = valueFns; - }; - - // ==================== scale =================== - - $.cssNumber.scale = true; - - $.cssHooks.scale = { - set: function( elem, value ) { - // uncomment this bit if you want to properly parse strings - // if ( typeof value === 'string' ) { - // value = parseFloat( value ); - // } - setIsoTransform( elem, 'scale', value ); - }, - get: function( elem, computed ) { - var transform = $.data( elem, 'isoTransform' ); - return transform && transform.scale ? transform.scale : 1; - } - }; - - $.fx.step.scale = function( fx ) { - $.cssHooks.scale.set( fx.elem, fx.now+fx.unit ); - }; - - - // ==================== translate =================== - - $.cssNumber.translate = true; - - $.cssHooks.translate = { - set: function( elem, value ) { - - // uncomment this bit if you want to properly parse strings - // if ( typeof value === 'string' ) { - // value = value.split(' '); - // } - // - // var i, val; - // for ( i = 0; i < 2; i++ ) { - // val = value[i]; - // if ( typeof val === 'string' ) { - // val = parseInt( val ); - // } - // } - - setIsoTransform( elem, 'translate', value ); - }, - - get: function( elem, computed ) { - var transform = $.data( elem, 'isoTransform' ); - return transform && transform.translate ? transform.translate : [ 0, 0 ]; - } - }; - - } - - // ========================= get transition-end event =============================== - var transitionEndEvent, transitionDurProp; - - if ( Modernizr.csstransitions ) { - transitionEndEvent = { - WebkitTransitionProperty: 'webkitTransitionEnd', // webkit - MozTransitionProperty: 'transitionend', - OTransitionProperty: 'oTransitionEnd otransitionend', - transitionProperty: 'transitionend' - }[ transitionProp ]; - - transitionDurProp = getStyleProperty('transitionDuration'); - } - - // ========================= smartresize =============================== - - /* - * smartresize: debounced resize event for jQuery - * - * latest version and complete README available on Github: - * https://github.com/louisremi/jquery.smartresize.js - * - * Copyright 2011 @louis_remi - * Licensed under the MIT license. - */ - - var $event = $.event, - dispatchMethod = $.event.handle ? 'handle' : 'dispatch', - resizeTimeout; - - $event.special.smartresize = { - setup: function() { - $(this).bind( "resize", $event.special.smartresize.handler ); - }, - teardown: function() { - $(this).unbind( "resize", $event.special.smartresize.handler ); - }, - handler: function( event, execAsap ) { - // Save the context - var context = this, - args = arguments; - - // set correct event type - event.type = "smartresize"; - - if ( resizeTimeout ) { clearTimeout( resizeTimeout ); } - resizeTimeout = setTimeout(function() { - $event[ dispatchMethod ].apply( context, args ); - }, execAsap === "execAsap"? 0 : 100 ); - } - }; - - $.fn.smartresize = function( fn ) { - return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] ); - }; - - - -// ========================= Isotope =============================== - - - // our "Widget" object constructor - $.Isotope = function( options, element, callback ){ - this.element = $( element ); - - this._create( options ); - this._init( callback ); - }; - - // styles of container element we want to keep track of - var isoContainerStyles = [ 'width', 'height' ]; - - var $window = $(window); - - $.Isotope.settings = { - resizable: true, - layoutMode : 'masonry', - containerClass : 'isotope', - itemClass : 'isotope-item', - hiddenClass : 'isotope-hidden', - hiddenStyle: { opacity: 0, scale: 0.001 }, - visibleStyle: { opacity: 1, scale: 1 }, - containerStyle: { - position: 'relative', - overflow: 'hidden' - }, - animationEngine: 'best-available', - animationOptions: { - queue: false, - duration: 800 - }, - sortBy : 'original-order', - sortAscending : true, - resizesContainer : true, - transformsEnabled: true, - itemPositionDataEnabled: false - }; - - $.Isotope.prototype = { - - // sets up widget - _create : function( options ) { - - this.options = $.extend( {}, $.Isotope.settings, options ); - - this.styleQueue = []; - this.elemCount = 0; - - // get original styles in case we re-apply them in .destroy() - var elemStyle = this.element[0].style; - this.originalStyle = {}; - // keep track of container styles - var containerStyles = isoContainerStyles.slice(0); - for ( var prop in this.options.containerStyle ) { - containerStyles.push( prop ); - } - for ( var i=0, len = containerStyles.length; i < len; i++ ) { - prop = containerStyles[i]; - this.originalStyle[ prop ] = elemStyle[ prop ] || ''; - } - // apply container style from options - this.element.css( this.options.containerStyle ); - - this._updateAnimationEngine(); - this._updateUsingTransforms(); - - // sorting - var originalOrderSorter = { - 'original-order' : function( $elem, instance ) { - instance.elemCount ++; - return instance.elemCount; - }, - random : function() { - return Math.random(); - } - }; - - this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter ); - - // need to get atoms - this.reloadItems(); - - // get top left position of where the bricks should be - this.offset = { - left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ), - top: parseInt( ( this.element.css('padding-top') || 0 ), 10 ) - }; - - // add isotope class first time around - var instance = this; - setTimeout( function() { - instance.element.addClass( instance.options.containerClass ); - }, 0 ); - - // bind resize method - if ( this.options.resizable ) { - $window.bind( 'smartresize.isotope', function() { - instance.resize(); - }); - } - - // dismiss all click events from hidden events - this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){ - return false; - }); - - }, - - _getAtoms : function( $elems ) { - var selector = this.options.itemSelector, - // filter & find - $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems, - // base style for atoms - atomStyle = { position: 'absolute' }; - - // filter out text nodes - $atoms = $atoms.filter( function( i, atom ) { - return atom.nodeType === 1; - }); - - if ( this.usingTransforms ) { - atomStyle.left = 0; - atomStyle.top = 0; - } - - $atoms.css( atomStyle ).addClass( this.options.itemClass ); - - this.updateSortData( $atoms, true ); - - return $atoms; - }, - - // _init fires when your instance is first created - // (from the constructor above), and when you - // attempt to initialize the widget again (by the bridge) - // after it has already been initialized. - _init : function( callback ) { - - this.$filteredAtoms = this._filter( this.$allAtoms ); - this._sort(); - this.reLayout( callback ); - - }, - - option : function( opts ){ - // change options AFTER initialization: - // signature: $('#foo').bar({ cool:false }); - if ( $.isPlainObject( opts ) ){ - this.options = $.extend( true, this.options, opts ); - - // trigger _updateOptionName if it exists - var updateOptionFn; - for ( var optionName in opts ) { - updateOptionFn = '_update' + capitalize( optionName ); - if ( this[ updateOptionFn ] ) { - this[ updateOptionFn ](); - } - } - } - }, - - // ====================== updaters ====================== // - // kind of like setters - - _updateAnimationEngine : function() { - var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, ''); - var isUsingJQueryAnimation; - // set applyStyleFnName - switch ( animationEngine ) { - case 'css' : - case 'none' : - isUsingJQueryAnimation = false; - break; - case 'jquery' : - isUsingJQueryAnimation = true; - break; - default : // best available - isUsingJQueryAnimation = !Modernizr.csstransitions; - } - this.isUsingJQueryAnimation = isUsingJQueryAnimation; - this._updateUsingTransforms(); - }, - - _updateTransformsEnabled : function() { - this._updateUsingTransforms(); - }, - - _updateUsingTransforms : function() { - var usingTransforms = this.usingTransforms = this.options.transformsEnabled && - Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation; - - // prevent scales when transforms are disabled - if ( !usingTransforms ) { - delete this.options.hiddenStyle.scale; - delete this.options.visibleStyle.scale; - } - - this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs; - }, - - - // ====================== Filtering ====================== - - _filter : function( $atoms ) { - var filter = this.options.filter === '' ? '*' : this.options.filter; - - if ( !filter ) { - return $atoms; - } - - var hiddenClass = this.options.hiddenClass, - hiddenSelector = '.' + hiddenClass, - $hiddenAtoms = $atoms.filter( hiddenSelector ), - $atomsToShow = $hiddenAtoms; - - if ( filter !== '*' ) { - $atomsToShow = $hiddenAtoms.filter( filter ); - var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass ); - this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle }); - } - - this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle }); - $atomsToShow.removeClass( hiddenClass ); - - return $atoms.filter( filter ); - }, - - // ====================== Sorting ====================== - - updateSortData : function( $atoms, isIncrementingElemCount ) { - var instance = this, - getSortData = this.options.getSortData, - $this, sortData; - $atoms.each(function(){ - $this = $(this); - sortData = {}; - // get value for sort data based on fn( $elem ) passed in - for ( var key in getSortData ) { - if ( !isIncrementingElemCount && key === 'original-order' ) { - // keep original order original - sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ]; - } else { - sortData[ key ] = getSortData[ key ]( $this, instance ); - } - } - // apply sort data to element - $.data( this, 'isotope-sort-data', sortData ); - }); - }, - - // used on all the filtered atoms - _sort : function() { - - var sortBy = this.options.sortBy, - getSorter = this._getSorter, - sortDir = this.options.sortAscending ? 1 : -1, - sortFn = function( alpha, beta ) { - var a = getSorter( alpha, sortBy ), - b = getSorter( beta, sortBy ); - // fall back to original order if data matches - if ( a === b && sortBy !== 'original-order') { - a = getSorter( alpha, 'original-order' ); - b = getSorter( beta, 'original-order' ); - } - return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir; - }; - - this.$filteredAtoms.sort( sortFn ); - }, - - _getSorter : function( elem, sortBy ) { - return $.data( elem, 'isotope-sort-data' )[ sortBy ]; - }, - - // ====================== Layout Helpers ====================== - - _translate : function( x, y ) { - return { translate : [ x, y ] }; - }, - - _positionAbs : function( x, y ) { - return { left: x, top: y }; - }, - - _pushPosition : function( $elem, x, y ) { - x = Math.round( x + this.offset.left ); - y = Math.round( y + this.offset.top ); - var position = this.getPositionStyles( x, y ); - this.styleQueue.push({ $el: $elem, style: position }); - if ( this.options.itemPositionDataEnabled ) { - $elem.data('isotope-item-position', {x: x, y: y} ); - } - }, - - - // ====================== General Layout ====================== - - // used on collection of atoms (should be filtered, and sorted before ) - // accepts atoms-to-be-laid-out to start with - layout : function( $elems, callback ) { - - var layoutMode = this.options.layoutMode; - - // layout logic - this[ '_' + layoutMode + 'Layout' ]( $elems ); - - // set the size of the container - if ( this.options.resizesContainer ) { - var containerStyle = this[ '_' + layoutMode + 'GetContainerSize' ](); - this.styleQueue.push({ $el: this.element, style: containerStyle }); - } - - this._processStyleQueue( $elems, callback ); - - this.isLaidOut = true; - }, - - _processStyleQueue : function( $elems, callback ) { - // are we animating the layout arrangement? - // use plugin-ish syntax for css or animate - var styleFn = !this.isLaidOut ? 'css' : ( - this.isUsingJQueryAnimation ? 'animate' : 'css' - ), - animOpts = this.options.animationOptions, - onLayout = this.options.onLayout, - objStyleFn, processor, - triggerCallbackNow, callbackFn; - - // default styleQueue processor, may be overwritten down below - processor = function( i, obj ) { - obj.$el[ styleFn ]( obj.style, animOpts ); - }; - - if ( this._isInserting && this.isUsingJQueryAnimation ) { - // if using styleQueue to insert items - processor = function( i, obj ) { - // only animate if it not being inserted - objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn; - obj.$el[ objStyleFn ]( obj.style, animOpts ); - }; - - } else if ( callback || onLayout || animOpts.complete ) { - // has callback - var isCallbackTriggered = false, - // array of possible callbacks to trigger - callbacks = [ callback, onLayout, animOpts.complete ], - instance = this; - triggerCallbackNow = true; - // trigger callback only once - callbackFn = function() { - if ( isCallbackTriggered ) { - return; - } - var hollaback; - for (var i=0, len = callbacks.length; i < len; i++) { - hollaback = callbacks[i]; - if ( typeof hollaback === 'function' ) { - hollaback.call( instance.element, $elems, instance ); - } - } - isCallbackTriggered = true; - }; - - if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) { - // add callback to animation options - animOpts.complete = callbackFn; - triggerCallbackNow = false; - - } else if ( Modernizr.csstransitions ) { - // detect if first item has transition - var i = 0, - firstItem = this.styleQueue[0], - testElem = firstItem && firstItem.$el, - styleObj; - // get first non-empty jQ object - while ( !testElem || !testElem.length ) { - styleObj = this.styleQueue[ i++ ]; - // HACK: sometimes styleQueue[i] is undefined - if ( !styleObj ) { - return; - } - testElem = styleObj.$el; - } - // get transition duration of the first element in that object - // yeah, this is inexact - var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] ); - if ( duration > 0 ) { - processor = function( i, obj ) { - obj.$el[ styleFn ]( obj.style, animOpts ) - // trigger callback at transition end - .one( transitionEndEvent, callbackFn ); - }; - triggerCallbackNow = false; - } - } - } - - // process styleQueue - $.each( this.styleQueue, processor ); - - if ( triggerCallbackNow ) { - callbackFn(); - } - - // clear out queue for next time - this.styleQueue = []; - }, - - - resize : function() { - if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) { - this.reLayout(); - } - }, - - - reLayout : function( callback ) { - - this[ '_' + this.options.layoutMode + 'Reset' ](); - this.layout( this.$filteredAtoms, callback ); - - }, - - // ====================== Convenience methods ====================== - - // ====================== Adding items ====================== - - // adds a jQuery object of items to a isotope container - addItems : function( $content, callback ) { - var $newAtoms = this._getAtoms( $content ); - // add new atoms to atoms pools - this.$allAtoms = this.$allAtoms.add( $newAtoms ); - - if ( callback ) { - callback( $newAtoms ); - } - }, - - // convienence method for adding elements properly to any layout - // positions items, hides them, then animates them back in <--- very sezzy - insert : function( $content, callback ) { - // position items - this.element.append( $content ); - - var instance = this; - this.addItems( $content, function( $newAtoms ) { - var $newFilteredAtoms = instance._filter( $newAtoms ); - instance._addHideAppended( $newFilteredAtoms ); - instance._sort(); - instance.reLayout(); - instance._revealAppended( $newFilteredAtoms, callback ); - }); - - }, - - // convienence method for working with Infinite Scroll - appended : function( $content, callback ) { - var instance = this; - this.addItems( $content, function( $newAtoms ) { - instance._addHideAppended( $newAtoms ); - instance.layout( $newAtoms ); - instance._revealAppended( $newAtoms, callback ); - }); - }, - - // adds new atoms, then hides them before positioning - _addHideAppended : function( $newAtoms ) { - this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms ); - $newAtoms.addClass('no-transition'); - - this._isInserting = true; - - // apply hidden styles - this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle }); - }, - - // sets visible style on new atoms - _revealAppended : function( $newAtoms, callback ) { - var instance = this; - // apply visible style after a sec - setTimeout( function() { - // enable animation - $newAtoms.removeClass('no-transition'); - // reveal newly inserted filtered elements - instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle }); - instance._isInserting = false; - instance._processStyleQueue( $newAtoms, callback ); - }, 10 ); - }, - - // gathers all atoms - reloadItems : function() { - this.$allAtoms = this._getAtoms( this.element.children() ); - }, - - // removes elements from Isotope widget - remove: function( $content, callback ) { - // remove elements immediately from Isotope instance - this.$allAtoms = this.$allAtoms.not( $content ); - this.$filteredAtoms = this.$filteredAtoms.not( $content ); - // remove() as a callback, for after transition / animation - var instance = this; - var removeContent = function() { - $content.remove(); - if ( callback ) { - callback.call( instance.element ); - } - }; - - if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) { - // if any non-hidden content needs to be removed - this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle }); - this._sort(); - this.reLayout( removeContent ); - } else { - // remove it now - removeContent(); - } - - }, - - shuffle : function( callback ) { - this.updateSortData( this.$allAtoms ); - this.options.sortBy = 'random'; - this._sort(); - this.reLayout( callback ); - }, - - // destroys widget, returns elements and container back (close) to original style - destroy : function() { - - var usingTransforms = this.usingTransforms; - var options = this.options; - - this.$allAtoms - .removeClass( options.hiddenClass + ' ' + options.itemClass ) - .each(function(){ - var style = this.style; - style.position = ''; - style.top = ''; - style.left = ''; - style.opacity = ''; - if ( usingTransforms ) { - style[ transformProp ] = ''; - } - }); - - // re-apply saved container styles - var elemStyle = this.element[0].style; - for ( var prop in this.originalStyle ) { - elemStyle[ prop ] = this.originalStyle[ prop ]; - } - - this.element - .unbind('.isotope') - .undelegate( '.' + options.hiddenClass, 'click' ) - .removeClass( options.containerClass ) - .removeData('isotope'); - - $window.unbind('.isotope'); - - }, - - - // ====================== LAYOUTS ====================== - - // calculates number of rows or columns - // requires columnWidth or rowHeight to be set on namespaced object - // i.e. this.masonry.columnWidth = 200 - _getSegments : function( isRows ) { - var namespace = this.options.layoutMode, - measure = isRows ? 'rowHeight' : 'columnWidth', - size = isRows ? 'height' : 'width', - segmentsName = isRows ? 'rows' : 'cols', - containerSize = this.element[ size ](), - segments, - // i.e. options.masonry && options.masonry.columnWidth - segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] || - // or use the size of the first item, i.e. outerWidth - this.$filteredAtoms[ 'outer' + capitalize(size) ](true) || - // if there's no items, use size of container - containerSize; - - segments = Math.floor( containerSize / segmentSize ); - segments = Math.max( segments, 1 ); - - // i.e. this.masonry.cols = .... - this[ namespace ][ segmentsName ] = segments; - // i.e. this.masonry.columnWidth = ... - this[ namespace ][ measure ] = segmentSize; - - }, - - _checkIfSegmentsChanged : function( isRows ) { - var namespace = this.options.layoutMode, - segmentsName = isRows ? 'rows' : 'cols', - prevSegments = this[ namespace ][ segmentsName ]; - // update cols/rows - this._getSegments( isRows ); - // return if updated cols/rows is not equal to previous - return ( this[ namespace ][ segmentsName ] !== prevSegments ); - }, - - // ====================== Masonry ====================== - - _masonryReset : function() { - // layout-specific props - this.masonry = {}; - // FIXME shouldn't have to call this again - this._getSegments(); - var i = this.masonry.cols; - this.masonry.colYs = []; - while (i--) { - this.masonry.colYs.push( 0 ); - } - }, - - _masonryLayout : function( $elems ) { - var instance = this, - props = instance.masonry; - $elems.each(function(){ - var $this = $(this), - //how many columns does this brick span - colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth ); - colSpan = Math.min( colSpan, props.cols ); - - if ( colSpan === 1 ) { - // if brick spans only one column, just like singleMode - instance._masonryPlaceBrick( $this, props.colYs ); - } else { - // brick spans more than one column - // how many different places could this brick fit horizontally - var groupCount = props.cols + 1 - colSpan, - groupY = [], - groupColY, - i; - - // for each group potential horizontal position - for ( i=0; i < groupCount; i++ ) { - // make an array of colY values for that one group - groupColY = props.colYs.slice( i, i+colSpan ); - // and get the max value of the array - groupY[i] = Math.max.apply( Math, groupColY ); - } - - instance._masonryPlaceBrick( $this, groupY ); - } - }); - }, - - // worker method that places brick in the columnSet - // with the the minY - _masonryPlaceBrick : function( $brick, setY ) { - // get the minimum Y value from the columns - var minimumY = Math.min.apply( Math, setY ), - shortCol = 0; - - // Find index of short column, the first from the left - for (var i=0, len = setY.length; i < len; i++) { - if ( setY[i] === minimumY ) { - shortCol = i; - break; - } - } - - // position the brick - var x = this.masonry.columnWidth * shortCol, - y = minimumY; - this._pushPosition( $brick, x, y ); - - // apply setHeight to necessary columns - var setHeight = minimumY + $brick.outerHeight(true), - setSpan = this.masonry.cols + 1 - len; - for ( i=0; i < setSpan; i++ ) { - this.masonry.colYs[ shortCol + i ] = setHeight; - } - - }, - - _masonryGetContainerSize : function() { - var containerHeight = Math.max.apply( Math, this.masonry.colYs ); - return { height: containerHeight }; - }, - - _masonryResizeChanged : function() { - return this._checkIfSegmentsChanged(); - }, - - // ====================== fitRows ====================== - - _fitRowsReset : function() { - this.fitRows = { - x : 0, - y : 0, - height : 0 - }; - }, - - _fitRowsLayout : function( $elems ) { - var instance = this, - containerWidth = this.element.width(), - props = this.fitRows; - - $elems.each( function() { - var $this = $(this), - atomW = $this.outerWidth(true), - atomH = $this.outerHeight(true); - - if ( props.x !== 0 && atomW + props.x > containerWidth ) { - // if this element cannot fit in the current row - props.x = 0; - props.y = props.height; - } - - // position the atom - instance._pushPosition( $this, props.x, props.y ); - - props.height = Math.max( props.y + atomH, props.height ); - props.x += atomW; - - }); - }, - - _fitRowsGetContainerSize : function () { - return { height : this.fitRows.height }; - }, - - _fitRowsResizeChanged : function() { - return true; - }, - - - // ====================== cellsByRow ====================== - - _cellsByRowReset : function() { - this.cellsByRow = { - index : 0 - }; - // get this.cellsByRow.columnWidth - this._getSegments(); - // get this.cellsByRow.rowHeight - this._getSegments(true); - }, - - _cellsByRowLayout : function( $elems ) { - var instance = this, - props = this.cellsByRow; - $elems.each( function(){ - var $this = $(this), - col = props.index % props.cols, - row = Math.floor( props.index / props.cols ), - x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2, - y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2; - instance._pushPosition( $this, x, y ); - props.index ++; - }); - }, - - _cellsByRowGetContainerSize : function() { - return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top }; - }, - - _cellsByRowResizeChanged : function() { - return this._checkIfSegmentsChanged(); - }, - - - // ====================== straightDown ====================== - - _straightDownReset : function() { - this.straightDown = { - y : 0 - }; - }, - - _straightDownLayout : function( $elems ) { - var instance = this; - $elems.each( function( i ){ - var $this = $(this); - instance._pushPosition( $this, 0, instance.straightDown.y ); - instance.straightDown.y += $this.outerHeight(true); - }); - }, - - _straightDownGetContainerSize : function() { - return { height : this.straightDown.y }; - }, - - _straightDownResizeChanged : function() { - return true; - }, - - - // ====================== masonryHorizontal ====================== - - _masonryHorizontalReset : function() { - // layout-specific props - this.masonryHorizontal = {}; - // FIXME shouldn't have to call this again - this._getSegments( true ); - var i = this.masonryHorizontal.rows; - this.masonryHorizontal.rowXs = []; - while (i--) { - this.masonryHorizontal.rowXs.push( 0 ); - } - }, - - _masonryHorizontalLayout : function( $elems ) { - var instance = this, - props = instance.masonryHorizontal; - $elems.each(function(){ - var $this = $(this), - //how many rows does this brick span - rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight ); - rowSpan = Math.min( rowSpan, props.rows ); - - if ( rowSpan === 1 ) { - // if brick spans only one column, just like singleMode - instance._masonryHorizontalPlaceBrick( $this, props.rowXs ); - } else { - // brick spans more than one row - // how many different places could this brick fit horizontally - var groupCount = props.rows + 1 - rowSpan, - groupX = [], - groupRowX, i; - - // for each group potential horizontal position - for ( i=0; i < groupCount; i++ ) { - // make an array of colY values for that one group - groupRowX = props.rowXs.slice( i, i+rowSpan ); - // and get the max value of the array - groupX[i] = Math.max.apply( Math, groupRowX ); - } - - instance._masonryHorizontalPlaceBrick( $this, groupX ); - } - }); - }, - - _masonryHorizontalPlaceBrick : function( $brick, setX ) { - // get the minimum Y value from the columns - var minimumX = Math.min.apply( Math, setX ), - smallRow = 0; - // Find index of smallest row, the first from the top - for (var i=0, len = setX.length; i < len; i++) { - if ( setX[i] === minimumX ) { - smallRow = i; - break; - } - } - - // position the brick - var x = minimumX, - y = this.masonryHorizontal.rowHeight * smallRow; - this._pushPosition( $brick, x, y ); - - // apply setHeight to necessary columns - var setWidth = minimumX + $brick.outerWidth(true), - setSpan = this.masonryHorizontal.rows + 1 - len; - for ( i=0; i < setSpan; i++ ) { - this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth; - } - }, - - _masonryHorizontalGetContainerSize : function() { - var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs ); - return { width: containerWidth }; - }, - - _masonryHorizontalResizeChanged : function() { - return this._checkIfSegmentsChanged(true); - }, - - - // ====================== fitColumns ====================== - - _fitColumnsReset : function() { - this.fitColumns = { - x : 0, - y : 0, - width : 0 - }; - }, - - _fitColumnsLayout : function( $elems ) { - var instance = this, - containerHeight = this.element.height(), - props = this.fitColumns; - $elems.each( function() { - var $this = $(this), - atomW = $this.outerWidth(true), - atomH = $this.outerHeight(true); - - if ( props.y !== 0 && atomH + props.y > containerHeight ) { - // if this element cannot fit in the current column - props.x = props.width; - props.y = 0; - } - - // position the atom - instance._pushPosition( $this, props.x, props.y ); - - props.width = Math.max( props.x + atomW, props.width ); - props.y += atomH; - - }); - }, - - _fitColumnsGetContainerSize : function () { - return { width : this.fitColumns.width }; - }, - - _fitColumnsResizeChanged : function() { - return true; - }, - - - - // ====================== cellsByColumn ====================== - - _cellsByColumnReset : function() { - this.cellsByColumn = { - index : 0 - }; - // get this.cellsByColumn.columnWidth - this._getSegments(); - // get this.cellsByColumn.rowHeight - this._getSegments(true); - }, - - _cellsByColumnLayout : function( $elems ) { - var instance = this, - props = this.cellsByColumn; - $elems.each( function(){ - var $this = $(this), - col = Math.floor( props.index / props.rows ), - row = props.index % props.rows, - x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2, - y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2; - instance._pushPosition( $this, x, y ); - props.index ++; - }); - }, - - _cellsByColumnGetContainerSize : function() { - return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth }; - }, - - _cellsByColumnResizeChanged : function() { - return this._checkIfSegmentsChanged(true); - }, - - // ====================== straightAcross ====================== - - _straightAcrossReset : function() { - this.straightAcross = { - x : 0 - }; - }, - - _straightAcrossLayout : function( $elems ) { - var instance = this; - $elems.each( function( i ){ - var $this = $(this); - instance._pushPosition( $this, instance.straightAcross.x, 0 ); - instance.straightAcross.x += $this.outerWidth(true); - }); - }, - - _straightAcrossGetContainerSize : function() { - return { width : this.straightAcross.x }; - }, - - _straightAcrossResizeChanged : function() { - return true; - } - - }; - - - // ======================= imagesLoaded Plugin =============================== - /*! - * jQuery imagesLoaded plugin v1.1.0 - * http://github.com/desandro/imagesloaded - * - * MIT License. by Paul Irish et al. - */ - - - // $('#my-container').imagesLoaded(myFunction) - // or - // $('img').imagesLoaded(myFunction) - - // execute a callback when all images have loaded. - // needed because .load() doesn't work on cached images - - // callback function gets image collection as argument - // `this` is the container - - $.fn.imagesLoaded = function( callback ) { - var $this = this, - $images = $this.find('img').add( $this.filter('img') ), - len = $images.length, - blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==', - loaded = []; - - function triggerCallback() { - callback.call( $this, $images ); - } - - function imgLoaded( event ) { - var img = event.target; - if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){ - loaded.push( img ); - if ( --len <= 0 ){ - setTimeout( triggerCallback ); - $images.unbind( '.imagesLoaded', imgLoaded ); - } - } - } - - // if no images, trigger immediately - if ( !len ) { - triggerCallback(); - } - - $images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoaded ).each( function() { - // cached images don't fire load sometimes, so we reset src. - var src = this.src; - // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f - // data uri bypasses webkit log warning (thx doug jones) - this.src = blank; - this.src = src; - }); - - return $this; - }; - - - // helper function for logging errors - // $.error breaks jQuery chaining - var logError = function( message ) { - if ( window.console ) { - window.console.error( message ); - } - }; - - // ======================= Plugin bridge =============================== - // leverages data method to either create or return $.Isotope constructor - // A bit from jQuery UI - // https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js - // A bit from jcarousel - // https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js - - $.fn.isotope = function( options, callback ) { - if ( typeof options === 'string' ) { - // call method - var args = Array.prototype.slice.call( arguments, 1 ); - - this.each(function(){ - var instance = $.data( this, 'isotope' ); - if ( !instance ) { - logError( "cannot call methods on isotope prior to initialization; " + - "attempted to call method '" + options + "'" ); - return; - } - if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { - logError( "no such method '" + options + "' for isotope instance" ); - return; - } - // apply method - instance[ options ].apply( instance, args ); - }); - } else { - this.each(function() { - var instance = $.data( this, 'isotope' ); - if ( instance ) { - // apply options & init - instance.option( options ); - instance._init( callback ); - } else { - // initialize new instance - $.data( this, 'isotope', new $.Isotope( options, this, callback ) ); - } - }); - } - // return jQuery object - // so plugin methods do not have to - return this; - }; - -})( window, jQuery ); \ No newline at end of file diff --git a/jquery.isotope.min.js b/jquery.isotope.min.js deleted file mode 100644 index 5b02fa4..0000000 --- a/jquery.isotope.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Isotope v1.5.26 - * An exquisite jQuery plugin for magical layouts - * http://isotope.metafizzy.co - * - * Commercial use requires one-time purchase of a commercial license - * http://isotope.metafizzy.co/docs/license.html - * - * Non-commercial use is licensed under the MIT License - * - * Copyright 2014 Metafizzy - */ -!function(t,i){"use strict";var s,e=t.document,n=e.documentElement,o=t.Modernizr,r=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},a="Moz Webkit O Ms".split(" "),h=function(t){var i,s=n.style;if("string"==typeof s[t])return t;t=r(t);for(var e=0,o=a.length;o>e;e++)if(i=a[e]+t,"string"==typeof s[i])return i},l=h("transform"),u=h("transitionProperty"),c={csstransforms:function(){return!!l},csstransforms3d:function(){var t=!!h("perspective");if(t&&"webkitPerspective"in n.style){var s=i("").appendTo("head"),e=i('
').appendTo("html");t=3===e.height(),e.remove(),s.remove()}return t},csstransitions:function(){return!!u}};if(o)for(s in c)o.hasOwnProperty(s)||o.addTest(s,c[s]);else{o=t.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var d,f=" ";for(s in c)d=c[s](),o[s]=d,f+=" "+(d?"":"no-")+s;i("html").addClass(f)}if(o.csstransforms){var m=o.csstransforms3d?{translate:function(t){return"translate3d("+t[0]+"px, "+t[1]+"px, 0) "},scale:function(t){return"scale3d("+t+", "+t+", 1) "}}:{translate:function(t){return"translate("+t[0]+"px, "+t[1]+"px) "},scale:function(t){return"scale("+t+") "}},p=function(t,s,e){var n,o,r=i.data(t,"isoTransform")||{},a={},h={};a[s]=e,i.extend(r,a);for(n in r)o=r[n],h[n]=m[n](o);var u=h.translate||"",c=h.scale||"",d=u+c;i.data(t,"isoTransform",r),t.style[l]=d};i.cssNumber.scale=!0,i.cssHooks.scale={set:function(t,i){p(t,"scale",i)},get:function(t){var s=i.data(t,"isoTransform");return s&&s.scale?s.scale:1}},i.fx.step.scale=function(t){i.cssHooks.scale.set(t.elem,t.now+t.unit)},i.cssNumber.translate=!0,i.cssHooks.translate={set:function(t,i){p(t,"translate",i)},get:function(t){var s=i.data(t,"isoTransform");return s&&s.translate?s.translate:[0,0]}}}var y,g;o.csstransitions&&(y={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[u],g=h("transitionDuration"));var v,_=i.event,A=i.event.handle?"handle":"dispatch";_.special.smartresize={setup:function(){i(this).bind("resize",_.special.smartresize.handler)},teardown:function(){i(this).unbind("resize",_.special.smartresize.handler)},handler:function(t,i){var s=this,e=arguments;t.type="smartresize",v&&clearTimeout(v),v=setTimeout(function(){_[A].apply(s,e)},"execAsap"===i?0:100)}},i.fn.smartresize=function(t){return t?this.bind("smartresize",t):this.trigger("smartresize",["execAsap"])},i.Isotope=function(t,s,e){this.element=i(s),this._create(t),this._init(e)};var w=["width","height"],C=i(t);i.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},i.Isotope.prototype={_create:function(t){this.options=i.extend({},i.Isotope.settings,t),this.styleQueue=[],this.elemCount=0;var s=this.element[0].style;this.originalStyle={};var e=w.slice(0);for(var n in this.options.containerStyle)e.push(n);for(var o=0,r=e.length;r>o;o++)n=e[o],this.originalStyle[n]=s[n]||"";this.element.css(this.options.containerStyle),this._updateAnimationEngine(),this._updateUsingTransforms();var a={"original-order":function(t,i){return i.elemCount++,i.elemCount},random:function(){return Math.random()}};this.options.getSortData=i.extend(this.options.getSortData,a),this.reloadItems(),this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var h=this;setTimeout(function(){h.element.addClass(h.options.containerClass)},0),this.options.resizable&&C.bind("smartresize.isotope",function(){h.resize()}),this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(t){var i=this.options.itemSelector,s=i?t.filter(i).add(t.find(i)):t,e={position:"absolute"};return s=s.filter(function(t,i){return 1===i.nodeType}),this.usingTransforms&&(e.left=0,e.top=0),s.css(e).addClass(this.options.itemClass),this.updateSortData(s,!0),s},_init:function(t){this.$filteredAtoms=this._filter(this.$allAtoms),this._sort(),this.reLayout(t)},option:function(t){if(i.isPlainObject(t)){this.options=i.extend(!0,this.options,t);var s;for(var e in t)s="_update"+r(e),this[s]&&this[s]()}},_updateAnimationEngine:function(){var t,i=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,"");switch(i){case"css":case"none":t=!1;break;case"jquery":t=!0;break;default:t=!o.csstransitions}this.isUsingJQueryAnimation=t,this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var t=this.usingTransforms=this.options.transformsEnabled&&o.csstransforms&&o.csstransitions&&!this.isUsingJQueryAnimation;t||(delete this.options.hiddenStyle.scale,delete this.options.visibleStyle.scale),this.getPositionStyles=t?this._translate:this._positionAbs},_filter:function(t){var i=""===this.options.filter?"*":this.options.filter;if(!i)return t;var s=this.options.hiddenClass,e="."+s,n=t.filter(e),o=n;if("*"!==i){o=n.filter(i);var r=t.not(e).not(i).addClass(s);this.styleQueue.push({$el:r,style:this.options.hiddenStyle})}return this.styleQueue.push({$el:o,style:this.options.visibleStyle}),o.removeClass(s),t.filter(i)},updateSortData:function(t,s){var e,n,o=this,r=this.options.getSortData;t.each(function(){e=i(this),n={};for(var t in r)n[t]=s||"original-order"!==t?r[t](e,o):i.data(this,"isotope-sort-data")[t];i.data(this,"isotope-sort-data",n)})},_sort:function(){var t=this.options.sortBy,i=this._getSorter,s=this.options.sortAscending?1:-1,e=function(e,n){var o=i(e,t),r=i(n,t);return o===r&&"original-order"!==t&&(o=i(e,"original-order"),r=i(n,"original-order")),(o>r?1:r>o?-1:0)*s};this.$filteredAtoms.sort(e)},_getSorter:function(t,s){return i.data(t,"isotope-sort-data")[s]},_translate:function(t,i){return{translate:[t,i]}},_positionAbs:function(t,i){return{left:t,top:i}},_pushPosition:function(t,i,s){i=Math.round(i+this.offset.left),s=Math.round(s+this.offset.top);var e=this.getPositionStyles(i,s);this.styleQueue.push({$el:t,style:e}),this.options.itemPositionDataEnabled&&t.data("isotope-item-position",{x:i,y:s})},layout:function(t,i){var s=this.options.layoutMode;if(this["_"+s+"Layout"](t),this.options.resizesContainer){var e=this["_"+s+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:e})}this._processStyleQueue(t,i),this.isLaidOut=!0},_processStyleQueue:function(t,s){var e,n,r,a,h=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",l=this.options.animationOptions,u=this.options.onLayout;if(n=function(t,i){i.$el[h](i.style,l)},this._isInserting&&this.isUsingJQueryAnimation)n=function(t,i){e=i.$el.hasClass("no-transition")?"css":h,i.$el[e](i.style,l)};else if(s||u||l.complete){var c=!1,d=[s,u,l.complete],f=this;if(r=!0,a=function(){if(!c){for(var i,s=0,e=d.length;e>s;s++)i=d[s],"function"==typeof i&&i.call(f.element,t,f);c=!0}},this.isUsingJQueryAnimation&&"animate"===h)l.complete=a,r=!1;else if(o.csstransitions){for(var m,p=0,v=this.styleQueue[0],_=v&&v.$el;!_||!_.length;){if(m=this.styleQueue[p++],!m)return;_=m.$el}var A=parseFloat(getComputedStyle(_[0])[g]);A>0&&(n=function(t,i){i.$el[h](i.style,l).one(y,a)},r=!1)}}i.each(this.styleQueue,n),r&&a(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(t){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,t)},addItems:function(t,i){var s=this._getAtoms(t);this.$allAtoms=this.$allAtoms.add(s),i&&i(s)},insert:function(t,i){this.element.append(t);var s=this;this.addItems(t,function(t){var e=s._filter(t);s._addHideAppended(e),s._sort(),s.reLayout(),s._revealAppended(e,i)})},appended:function(t,i){var s=this;this.addItems(t,function(t){s._addHideAppended(t),s.layout(t),s._revealAppended(t,i)})},_addHideAppended:function(t){this.$filteredAtoms=this.$filteredAtoms.add(t),t.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:t,style:this.options.hiddenStyle})},_revealAppended:function(t,i){var s=this;setTimeout(function(){t.removeClass("no-transition"),s.styleQueue.push({$el:t,style:s.options.visibleStyle}),s._isInserting=!1,s._processStyleQueue(t,i)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(t,i){this.$allAtoms=this.$allAtoms.not(t),this.$filteredAtoms=this.$filteredAtoms.not(t);var s=this,e=function(){t.remove(),i&&i.call(s.element)};t.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:t,style:this.options.hiddenStyle}),this._sort(),this.reLayout(e)):e()},shuffle:function(t){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(t)},destroy:function(){var t=this.usingTransforms,i=this.options;this.$allAtoms.removeClass(i.hiddenClass+" "+i.itemClass).each(function(){var i=this.style;i.position="",i.top="",i.left="",i.opacity="",t&&(i[l]="")});var s=this.element[0].style;for(var e in this.originalStyle)s[e]=this.originalStyle[e];this.element.unbind(".isotope").undelegate("."+i.hiddenClass,"click").removeClass(i.containerClass).removeData("isotope"),C.unbind(".isotope")},_getSegments:function(t){var i,s=this.options.layoutMode,e=t?"rowHeight":"columnWidth",n=t?"height":"width",o=t?"rows":"cols",a=this.element[n](),h=this.options[s]&&this.options[s][e]||this.$filteredAtoms["outer"+r(n)](!0)||a;i=Math.floor(a/h),i=Math.max(i,1),this[s][o]=i,this[s][e]=h},_checkIfSegmentsChanged:function(t){var i=this.options.layoutMode,s=t?"rows":"cols",e=this[i][s];return this._getSegments(t),this[i][s]!==e},_masonryReset:function(){this.masonry={},this._getSegments();var t=this.masonry.cols;for(this.masonry.colYs=[];t--;)this.masonry.colYs.push(0)},_masonryLayout:function(t){var s=this,e=s.masonry;t.each(function(){var t=i(this),n=Math.ceil(t.outerWidth(!0)/e.columnWidth);if(n=Math.min(n,e.cols),1===n)s._masonryPlaceBrick(t,e.colYs);else{var o,r,a=e.cols+1-n,h=[];for(r=0;a>r;r++)o=e.colYs.slice(r,r+n),h[r]=Math.max.apply(Math,o);s._masonryPlaceBrick(t,h)}})},_masonryPlaceBrick:function(t,i){for(var s=Math.min.apply(Math,i),e=0,n=0,o=i.length;o>n;n++)if(i[n]===s){e=n;break}var r=this.masonry.columnWidth*e,a=s;this._pushPosition(t,r,a);var h=s+t.outerHeight(!0),l=this.masonry.cols+1-o;for(n=0;l>n;n++)this.masonry.colYs[e+n]=h},_masonryGetContainerSize:function(){var t=Math.max.apply(Math,this.masonry.colYs);return{height:t}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(t){var s=this,e=this.element.width(),n=this.fitRows;t.each(function(){var t=i(this),o=t.outerWidth(!0),r=t.outerHeight(!0);0!==n.x&&o+n.x>e&&(n.x=0,n.y=n.height),s._pushPosition(t,n.x,n.y),n.height=Math.max(n.y+r,n.height),n.x+=o})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(t){var s=this,e=this.cellsByRow;t.each(function(){var t=i(this),n=e.index%e.cols,o=Math.floor(e.index/e.cols),r=(n+.5)*e.columnWidth-t.outerWidth(!0)/2,a=(o+.5)*e.rowHeight-t.outerHeight(!0)/2;s._pushPosition(t,r,a),e.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(t){var s=this;t.each(function(){var t=i(this);s._pushPosition(t,0,s.straightDown.y),s.straightDown.y+=t.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var t=this.masonryHorizontal.rows;for(this.masonryHorizontal.rowXs=[];t--;)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(t){var s=this,e=s.masonryHorizontal;t.each(function(){var t=i(this),n=Math.ceil(t.outerHeight(!0)/e.rowHeight);if(n=Math.min(n,e.rows),1===n)s._masonryHorizontalPlaceBrick(t,e.rowXs);else{var o,r,a=e.rows+1-n,h=[];for(r=0;a>r;r++)o=e.rowXs.slice(r,r+n),h[r]=Math.max.apply(Math,o);s._masonryHorizontalPlaceBrick(t,h)}})},_masonryHorizontalPlaceBrick:function(t,i){for(var s=Math.min.apply(Math,i),e=0,n=0,o=i.length;o>n;n++)if(i[n]===s){e=n;break}var r=s,a=this.masonryHorizontal.rowHeight*e;this._pushPosition(t,r,a);var h=s+t.outerWidth(!0),l=this.masonryHorizontal.rows+1-o;for(n=0;l>n;n++)this.masonryHorizontal.rowXs[e+n]=h},_masonryHorizontalGetContainerSize:function(){var t=Math.max.apply(Math,this.masonryHorizontal.rowXs);return{width:t}},_masonryHorizontalResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_fitColumnsReset:function(){this.fitColumns={x:0,y:0,width:0}},_fitColumnsLayout:function(t){var s=this,e=this.element.height(),n=this.fitColumns;t.each(function(){var t=i(this),o=t.outerWidth(!0),r=t.outerHeight(!0);0!==n.y&&r+n.y>e&&(n.x=n.width,n.y=0),s._pushPosition(t,n.x,n.y),n.width=Math.max(n.x+o,n.width),n.y+=r})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(t){var s=this,e=this.cellsByColumn;t.each(function(){var t=i(this),n=Math.floor(e.index/e.rows),o=e.index%e.rows,r=(n+.5)*e.columnWidth-t.outerWidth(!0)/2,a=(o+.5)*e.rowHeight-t.outerHeight(!0)/2;s._pushPosition(t,r,a),e.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(t){var s=this;t.each(function(){var t=i(this);s._pushPosition(t,s.straightAcross.x,0),s.straightAcross.x+=t.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},i.fn.imagesLoaded=function(t){function s(){t.call(n,o)}function e(t){var n=t.target;n.src!==a&&-1===i.inArray(n,h)&&(h.push(n),--r<=0&&(setTimeout(s),o.unbind(".imagesLoaded",e)))}var n=this,o=n.find("img").add(n.filter("img")),r=o.length,a="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",h=[];return r||s(),o.bind("load.imagesLoaded error.imagesLoaded",e).each(function(){var t=this.src;this.src=a,this.src=t}),n};var z=function(i){t.console&&t.console.error(i)};i.fn.isotope=function(t,s){if("string"==typeof t){var e=Array.prototype.slice.call(arguments,1);this.each(function(){var s=i.data(this,"isotope");return s?i.isFunction(s[t])&&"_"!==t.charAt(0)?void s[t].apply(s,e):void z("no such method '"+t+"' for isotope instance"):void z("cannot call methods on isotope prior to initialization; attempted to call method '"+t+"'")})}else this.each(function(){var e=i.data(this,"isotope");e?(e.option(t),e._init(s)):i.data(this,"isotope",new i.Isotope(t,this,s))});return this}}(window,jQuery); \ No newline at end of file diff --git a/minify.sh b/minify.sh deleted file mode 100755 index 0b14e67..0000000 --- a/minify.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# minifies jquery.isotope.js -# requires nodejs & uglify-js - -IN=jquery.isotope.js -OUT=jquery.isotope.min.js - -uglifyjs $IN --compress conditionals=true --mangle --comments --output $OUT