Browse Source

update Outlayer v1.4.1; tick version 2.2.1

+ trigger jQuery events
+ Fix Safari transition issues - Fixes #945
+ remove problematic package.json devDeps
+ update grunt-contrib-uglify
pull/829/merge v2.2.1
David DeSandro 10 years ago
parent
commit
feff43802b
  1. 4
      README.mdown
  2. 6
      bower.json
  3. 7
      changelog.md
  4. 162
      dist/isotope.pkgd.js
  5. 4
      dist/isotope.pkgd.min.js
  6. 2
      js/isotope.js
  7. 15
      package.json
  8. 1
      sandbox/insert.html
  9. 220
      sandbox/jquery.html

4
README.mdown

@ -16,9 +16,9 @@ See [isotope.metafizzy.co](http://isotope.metafizzy.co) for complete docs and de
Link directly to [Isotope files on cdnjs](https://cdnjs.com/libraries/jquery.isotope). Link directly to [Isotope files on cdnjs](https://cdnjs.com/libraries/jquery.isotope).
``` html ``` html
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.0/isotope.pkgd.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.1/isotope.pkgd.js"></script>
<!-- or --> <!-- or -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.0/isotope.pkgd.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.1/isotope.pkgd.min.js"></script>
``` ```
### Package managers ### Package managers

6
bower.json

@ -1,12 +1,12 @@
{ {
"name": "isotope", "name": "isotope",
"version": "2.2.0", "version": "2.2.1",
"description": "Filter and sort magical layouts", "description": "Filter and sort magical layouts",
"main": "js/isotope.js", "main": "js/isotope.js",
"dependencies": { "dependencies": {
"get-size": "~1.2.2", "get-size": "~1.2.2",
"matches-selector": ">=1 <2", "matches-selector": "~1.0.2",
"outlayer": "~1.4.0", "outlayer": "~1.4.1",
"masonry": "~3.3.0", "masonry": "~3.3.0",
"fizzy-ui-utils": "~1.0.1" "fizzy-ui-utils": "~1.0.1"
}, },

7
changelog.md

@ -1,5 +1,12 @@
# Changelog # Changelog
### v2.2.1
Updated Outlayer v1.4.1
+ Added jQuery event triggering
+ Fix Safari layout bugs. Fixed [#945](https://github.com/metafizzy/isotope/issues/945)
## v2.2.0 ## v2.2.0
+ Revised license model. Isotope is licensed GPL by default. Purchasing a commercial license allows use outside of the GPL, under the Commercial License terms. Read details at: [isotope.metafizzy.co/license.html](http://isotope.metafizzy.co/license.html) + Revised license model. Isotope is licensed GPL by default. Purchasing a commercial license allows use outside of the GPL, under the Commercial License terms. Read details at: [isotope.metafizzy.co/license.html](http://isotope.metafizzy.co/license.html)

162
dist/isotope.pkgd.js vendored

@ -239,7 +239,7 @@ if ( typeof define === 'function' && define.amd ) {
*/ */
;(function () { ;(function () {
'use strict';
/** /**
* Class for managing events. * Class for managing events.
@ -1103,7 +1103,7 @@ if ( typeof define === 'function' && define.amd ) {
( function( ElemProto ) { ( function( ElemProto ) {
'use strict';
var matchesMethod = ( function() { var matchesMethod = ( function() {
// check for the standard method name first // check for the standard method name first
@ -1209,7 +1209,7 @@ if ( typeof define === 'function' && define.amd ) {
( function( window, factory ) { ( function( window, factory ) {
/*global define: false, module: false, require: false */ /*global define: false, module: false, require: false */
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
@ -1476,7 +1476,7 @@ return utils;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define === 'function' && define.amd ) { if ( typeof define === 'function' && define.amd ) {
// AMD // AMD
@ -1512,7 +1512,7 @@ return utils;
} }
}( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) { }( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) {
'use strict';
// ----- helpers ----- // // ----- helpers ----- //
@ -1635,14 +1635,19 @@ Item.prototype.getPosition = function() {
var layoutOptions = this.layout.options; var layoutOptions = this.layout.options;
var isOriginLeft = layoutOptions.isOriginLeft; var isOriginLeft = layoutOptions.isOriginLeft;
var isOriginTop = layoutOptions.isOriginTop; var isOriginTop = layoutOptions.isOriginTop;
var x = parseInt( style[ isOriginLeft ? 'left' : 'right' ], 10 ); var xValue = style[ isOriginLeft ? 'left' : 'right' ];
var y = parseInt( style[ isOriginTop ? 'top' : 'bottom' ], 10 ); var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
var x = parseInt( xValue, 10 );
var y = parseInt( yValue, 10 );
// convert percent to pixels
var layoutSize = this.layout.size;
x = xValue.indexOf('%') != -1 ? ( x / 100 ) * layoutSize.width : x;
y = yValue.indexOf('%') != -1 ? ( y / 100 ) * layoutSize.height : y;
// clean up 'auto' or other non-integer values // clean up 'auto' or other non-integer values
x = isNaN( x ) ? 0 : x; x = isNaN( x ) ? 0 : x;
y = isNaN( y ) ? 0 : y; y = isNaN( y ) ? 0 : y;
// remove padding from measurement // remove padding from measurement
var layoutSize = this.layout.size;
x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight; x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom; y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
@ -1662,10 +1667,8 @@ Item.prototype.layoutPosition = function() {
var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left'; var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left';
var x = this.position.x + layoutSize[ xPadding ]; var x = this.position.x + layoutSize[ xPadding ];
// set in percentage // set in percentage or pixels
x = layoutOptions.percentPosition && !layoutOptions.isHorizontal ? style[ xProperty ] = this.getXValue( x );
( ( x / layoutSize.width ) * 100 ) + '%' : x + 'px';
style[ xProperty ] = x;
// reset other property // reset other property
style[ xResetProperty ] = ''; style[ xResetProperty ] = '';
@ -1675,10 +1678,8 @@ Item.prototype.layoutPosition = function() {
var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top'; var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top';
var y = this.position.y + layoutSize[ yPadding ]; var y = this.position.y + layoutSize[ yPadding ];
// set in percentage // set in percentage or pixels
y = layoutOptions.percentPosition && layoutOptions.isHorizontal ? style[ yProperty ] = this.getYValue( y );
( ( y / layoutSize.height ) * 100 ) + '%' : y + 'px';
style[ yProperty ] = y;
// reset other property // reset other property
style[ yResetProperty ] = ''; style[ yResetProperty ] = '';
@ -1686,15 +1687,17 @@ Item.prototype.layoutPosition = function() {
this.emitEvent( 'layout', [ this ] ); this.emitEvent( 'layout', [ this ] );
}; };
Item.prototype.getXValue = function( x ) {
var layoutOptions = this.layout.options;
return layoutOptions.percentPosition && !layoutOptions.isHorizontal ?
( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
};
// transform translate function Item.prototype.getYValue = function( y ) {
var translate = is3d ? var layoutOptions = this.layout.options;
function( x, y ) { return layoutOptions.percentPosition && layoutOptions.isHorizontal ?
return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px';
} : };
function( x, y ) {
return 'translate(' + x + 'px, ' + y + 'px)';
};
Item.prototype._transitionTo = function( x, y ) { Item.prototype._transitionTo = function( x, y ) {
@ -1719,11 +1722,7 @@ Item.prototype._transitionTo = function( x, y ) {
var transX = x - curX; var transX = x - curX;
var transY = y - curY; var transY = y - curY;
var transitionStyle = {}; var transitionStyle = {};
// flip cooridinates if origin on right or bottom transitionStyle.transform = this.getTranslate( transX, transY );
var layoutOptions = this.layout.options;
transX = layoutOptions.isOriginLeft ? transX : -transX;
transY = layoutOptions.isOriginTop ? transY : -transY;
transitionStyle.transform = translate( transX, transY );
this.transition({ this.transition({
to: transitionStyle, to: transitionStyle,
@ -1734,6 +1733,21 @@ Item.prototype._transitionTo = function( x, y ) {
}); });
}; };
Item.prototype.getTranslate = function( x, y ) {
// flip cooridinates if origin on right or bottom
var layoutOptions = this.layout.options;
x = layoutOptions.isOriginLeft ? x : -x;
y = layoutOptions.isOriginTop ? y : -y;
x = this.getXValue( x );
y = this.getYValue( y );
if ( is3d ) {
return 'translate3d(' + x + ', ' + y + ', 0)';
}
return 'translate(' + x + ', ' + y + ')';
};
// non transition + transform support // non transition + transform support
Item.prototype.goTo = function( x, y ) { Item.prototype.goTo = function( x, y ) {
this.setPosition( x, y ); this.setPosition( x, y );
@ -1813,28 +1827,36 @@ Item.prototype._transition = function( args ) {
}; };
var itemTransitionProperties = transformProperty && ( utils.toDashed( transformProperty ) + // dash before all cap letters, including first for
',opacity' ); // WebkitTransform => -webkit-transform
function toDashedAll( str ) {
return str.replace( /([A-Z])/g, function( $1 ) {
return '-' + $1.toLowerCase();
});
}
var transitionProps = 'opacity,' +
toDashedAll( vendorProperties.transform || 'transform' );
Item.prototype.enableTransition = function(/* style */) { Item.prototype.enableTransition = function(/* style */) {
// only enable if not already transitioning // HACK changing transitionProperty during a transition
// bug in IE10 were re-setting transition style will prevent // will cause transition to jump
// transitionend event from triggering
if ( this.isTransitioning ) { if ( this.isTransitioning ) {
return; return;
} }
// make transition: foo, bar, baz from style object // make `transition: foo, bar, baz` from style object
// TODO uncomment this bit when IE10 bug is resolved // HACK un-comment this when enableTransition can work
// var transitionValue = []; // while a transition is happening
// var transitionValues = [];
// for ( var prop in style ) { // for ( var prop in style ) {
// // dash-ify camelCased properties like WebkitTransition // // dash-ify camelCased properties like WebkitTransition
// transitionValue.push( toDash( prop ) ); // prop = vendorProperties[ prop ] || prop;
// transitionValues.push( toDashedAll( prop ) );
// } // }
// enable transition styles // enable transition styles
// HACK always enable transform,opacity for IE10
this.css({ this.css({
transitionProperty: itemTransitionProperties, transitionProperty: transitionProps,
transitionDuration: this.layout.options.transitionDuration transitionDuration: this.layout.options.transitionDuration
}); });
// listen for transition end event // listen for transition end event
@ -2037,13 +2059,13 @@ return Item;
})); }));
/*! /*!
* Outlayer v1.4.0 * Outlayer v1.4.1
* the brains and guts of a layout library * the brains and guts of a layout library
* MIT license * MIT license
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
@ -2082,7 +2104,7 @@ return Item;
} }
}( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) { }( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) {
'use strict';
// ----- vars ----- // // ----- vars ----- //
@ -2452,7 +2474,7 @@ Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) {
Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) { Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
var _this = this; var _this = this;
function onComplete() { function onComplete() {
_this.emitEvent( eventName + 'Complete', [ items ] ); _this.dispatchEvent( eventName + 'Complete', null, [ items ] );
} }
var count = items.length; var count = items.length;
@ -2476,6 +2498,32 @@ Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
} }
}; };
/**
* emits events via eventEmitter and jQuery events
* @param {String} type - name of event
* @param {Event} event - original event
* @param {Array} args - extra arguments
*/
Outlayer.prototype.dispatchEvent = function( type, event, args ) {
// add original event to arguments
var emitArgs = event ? [ event ].concat( args ) : args;
this.emitEvent( type, emitArgs );
if ( jQuery ) {
// set this.$element
this.$element = this.$element || jQuery( this.element );
if ( event ) {
// create jQuery event
var $event = jQuery.Event( event );
$event.type = type;
this.$element.trigger( $event, args );
} else {
// just trigger with type if no event available
this.$element.trigger( type, args );
}
}
};
// -------------------------- ignore & stamps -------------------------- // // -------------------------- ignore & stamps -------------------------- //
@ -2942,7 +2990,7 @@ return Outlayer;
**/ **/
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
// AMD // AMD
@ -2964,7 +3012,7 @@ return Outlayer;
} }
}( window, function factory( Outlayer ) { }( window, function factory( Outlayer ) {
'use strict';
// -------------------------- Item -------------------------- // // -------------------------- Item -------------------------- //
@ -3019,7 +3067,7 @@ return Item;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
@ -3045,7 +3093,7 @@ return Item;
} }
}( window, function factory( getSize, Outlayer ) { }( window, function factory( getSize, Outlayer ) {
'use strict';
// layout mode class // layout mode class
function LayoutMode( isotope ) { function LayoutMode( isotope ) {
@ -3185,7 +3233,7 @@ return Item;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define === 'function' && define.amd ) { if ( typeof define === 'function' && define.amd ) {
// AMD // AMD
@ -3387,7 +3435,7 @@ return Item;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
// AMD // AMD
@ -3411,7 +3459,7 @@ return Item;
} }
}( window, function factory( LayoutMode, Masonry ) { }( window, function factory( LayoutMode, Masonry ) {
'use strict';
// -------------------------- helpers -------------------------- // // -------------------------- helpers -------------------------- //
@ -3465,7 +3513,7 @@ function extend( a, b ) {
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
// AMD // AMD
@ -3486,7 +3534,7 @@ function extend( a, b ) {
} }
}( window, function factory( LayoutMode ) { }( window, function factory( LayoutMode ) {
'use strict';
var FitRows = LayoutMode.create('fitRows'); var FitRows = LayoutMode.create('fitRows');
@ -3532,7 +3580,7 @@ return FitRows;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
// AMD // AMD
@ -3553,7 +3601,7 @@ return FitRows;
} }
}( window, function factory( LayoutMode ) { }( window, function factory( LayoutMode ) {
'use strict';
var Vertical = LayoutMode.create( 'vertical', { var Vertical = LayoutMode.create( 'vertical', {
horizontalAlignment: 0 horizontalAlignment: 0
@ -3591,7 +3639,7 @@ return Vertical;
*/ */
( function( window, factory ) { ( function( window, factory ) {
'use strict';
// universal module definition // universal module definition
if ( typeof define == 'function' && define.amd ) { if ( typeof define == 'function' && define.amd ) {
@ -3804,7 +3852,7 @@ var getText = docElem.textContent ?
var _this = this; var _this = this;
function arrangeParallelCallback() { function arrangeParallelCallback() {
if ( isLayoutComplete && isHideComplete && isRevealComplete ) { if ( isLayoutComplete && isHideComplete && isRevealComplete ) {
_this.emitEvent( 'arrangeComplete', [ _this.filteredItems ] ); _this.dispatchEvent( 'arrangeComplete', null, [ _this.filteredItems ] );
} }
} }
this.once( 'layoutComplete', function() { this.once( 'layoutComplete', function() {

4
dist/isotope.pkgd.min.js vendored

File diff suppressed because one or more lines are too long

2
js/isotope.js

@ -222,7 +222,7 @@ var getText = docElem.textContent ?
var _this = this; var _this = this;
function arrangeParallelCallback() { function arrangeParallelCallback() {
if ( isLayoutComplete && isHideComplete && isRevealComplete ) { if ( isLayoutComplete && isHideComplete && isRevealComplete ) {
_this.emitEvent( 'arrangeComplete', [ _this.filteredItems ] ); _this.dispatchEvent( 'arrangeComplete', null, [ _this.filteredItems ] );
} }
} }
this.once( 'layoutComplete', function() { this.once( 'layoutComplete', function() {

15
package.json

@ -1,24 +1,19 @@
{ {
"name": "isotope-layout", "name": "isotope-layout",
"version": "2.2.0", "version": "2.2.1",
"description": "Filter and sort magical layouts", "description": "Filter and sort magical layouts",
"main": "js/isotope.js", "main": "js/isotope.js",
"dependencies": { "dependencies": {
"desandro-matches-selector": "~1.0.2",
"fizzy-ui-utils": "~1.0.1",
"get-size": "~1.2.2", "get-size": "~1.2.2",
"desandro-matches-selector": ">=1 <2", "grunt-contrib-uglify": "^0.9.1",
"outlayer": "~1.4.0",
"masonry-layout": "~3.3.0", "masonry-layout": "~3.3.0",
"fizzy-ui-utils": "~1.0.1" "outlayer": "~1.4.1"
}, },
"devDependencies": { "devDependencies": {
"desandro-matches-selector": "^1.0.2",
"doc-ready": "1.x", "doc-ready": "1.x",
"eventie": "^1.0.5", "eventie": "^1.0.5",
"isotope-fit-columns": "1.1.x",
"isotope-cells-by-row": "~1.1.1",
"isotope-cells-by-column": "1.1.x",
"isotope-horizontal": "~1.1.1",
"isotope-masonry-horizontal": "1.1.x",
"jquery": ">=1.4.3 <2", "jquery": ">=1.4.3 <2",
"jquery-bridget": "1.1.x", "jquery-bridget": "1.1.x",
"qunitjs": "^1.15", "qunitjs": "^1.15",

1
sandbox/insert.html

@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width" />
<title>insert</title> <title>insert</title>

220
sandbox/jquery.html

@ -0,0 +1,220 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" />
<title>jquery</title>
<link rel="stylesheet" href="sandbox.css" />
<style>
#container { width: 100%; }
</style>
</head>
<body>
<h1>jquery</h1>
<div id="options">
<h2>Filter</h2>
<div class="option-set" data-isotope-key="filter">
<button data-isotope-value="*">show all</button>
<button data-isotope-value=".metal">metal</button>
<button data-isotope-value=".post-transition">post-transition</button>
<button data-isotope-value="number-greater-than-50">number > 50</button>
</div>
<h2>Sort</h2>
<div class="option-set" data-isotope-key="sortBy">
<button data-isotope-value="original-order">original-order</button>
<button data-isotope-value="number">number</button>
<button data-isotope-value="name">name</button>
<button data-isotope-value="symbol">symbol</button>
<button data-isotope-value="weight">weight</button>
<button data-isotope-value="category">category</button>
</div>
</div>
<div id="container">
<div class="element transition metal " data-symbol="Hg" data-category="transition">
<p class="number">80</p>
<h3 class="symbol">Hg</h3>
<h2 class="name">Mercury</h2>
<p class="weight">200.59</p>
</div>
<div class="element metalloid " data-symbol="Te" data-category="metalloid">
<p class="number">52</p>
<h3 class="symbol">Te</h3>
<h2 class="name">Tellurium</h2>
<p class="weight">127.6</p>
</div>
<div class="element post-transition metal " data-symbol="Bi" data-category="post-transition">
<p class="number">83</p>
<h3 class="symbol">Bi</h3>
<h2 class="name">Bismuth</h2>
<p class="weight">208.9804</p>
</div>
<div class="element transition metal " data-symbol="Cd" data-category="transition">
<p class="number">48</p>
<h3 class="symbol">Cd</h3>
<h2 class="name">Cadmium</h2>
<p class="weight">112.411</p>
</div>
<div class="element alkaline-earth metal " data-symbol="Ca" data-category="alkaline-earth">
<p class="number">20</p>
<h3 class="symbol">Ca</h3>
<h2 class="name">Calcium</h2>
<p class="weight">40.078</p>
</div>
<div class="element transition metal " data-symbol="Re" data-category="transition">
<p class="number">75</p>
<h3 class="symbol">Re</h3>
<h2 class="name">Rhenium</h2>
<p class="weight">186.207</p>
</div>
<div class="element post-transition metal " data-symbol="Tl" data-category="post-transition">
<p class="number">81</p>
<h3 class="symbol">Tl</h3>
<h2 class="name">Thallium</h2>
<p class="weight">204.3833</p>
</div>
<div class="element metalloid " data-symbol="Sb" data-category="metalloid">
<p class="number">51</p>
<h3 class="symbol">Sb</h3>
<h2 class="name">Antimony</h2>
<p class="weight">121.76</p>
</div>
<div class="element transition metal " data-symbol="Co" data-category="transition">
<p class="number">27</p>
<h3 class="symbol">Co</h3>
<h2 class="name">Cobalt</h2>
<p class="weight">58.933195</p>
</div>
<div class="element lanthanoid metal inner-transition " data-symbol="Lu" data-category="lanthanoid">
<p class="number">71</p>
<h3 class="symbol">Lu</h3>
<h2 class="name">Lutetium</h2>
<p class="weight">174.9668</p>
</div>
<div class="element noble-gas nonmetal " data-symbol="Ar" data-category="noble-gas">
<p class="number">18</p>
<h3 class="symbol">Ar</h3>
<h2 class="name">Argon</h2>
<p class="weight">39.948</p>
</div>
<div class="element alkali metal " data-symbol="Rb" data-category="alkali">
<p class="number">37</p>
<h3 class="symbol">Rb</h3>
<h2 class="name">Rubidium</h2>
<p class="weight">85.4678</p>
</div>
<div class="element other nonmetal " data-symbol="N" data-category="other">
<p class="number">7</p>
<h3 class="symbol">N</h3>
<h2 class="name">Nitrogen</h2>
<p class="weight">14.0067</p>
</div>
<div class="element actinoid metal inner-transition " data-symbol="Np" data-category="actinoid">
<p class="number">93</p>
<h3 class="symbol">Np</h3>
<h2 class="name">Neptunium</h2>
<p class="weight">(237)</p>
</div>
<div class="element actinoid metal inner-transition " data-symbol="Ac" data-category="actinoid">
<p class="number">89</p>
<h3 class="symbol">Ac</h3>
<h2 class="name">Actinium</h2>
<p class="weight">(227)</p>
</div>
</div>
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/jquery-bridget/jquery.bridget.js"></script>
<script src="../bower_components/eventEmitter/EventEmitter.js"></script>
<script src="../bower_components/eventie/eventie.js"></script>
<script src="../bower_components/doc-ready/doc-ready.js"></script>
<script src="../bower_components/get-style-property/get-style-property.js"></script>
<script src="../bower_components/get-size/get-size.js"></script>
<script src="../bower_components/jquery-bridget/jquery.bridget.js"></script>
<script src="../bower_components/matches-selector/matches-selector.js"></script>
<script src="../bower_components/fizzy-ui-utils/utils.js"></script>
<script src="../bower_components/outlayer/item.js"></script>
<script src="../bower_components/outlayer/outlayer.js"></script>
<script src="../js/item.js"></script>
<script src="../js/layout-mode.js"></script>
<script src="../js/isotope.js"></script>
<script src="../js/layout-modes/fit-rows.js"></script>
<script src="../js/layout-modes/vertical.js"></script>
<script>
$(document).ready( function() {
var container = document.querySelector('#container');
var $container = $('#container').isotope({
layoutMode: 'fitRows',
transitionDuration: '0.8s',
cellsByRow: {
columnWidth: 130,
rowHeight: 140,
},
getSortData: {
number: '.number parseInt',
symbol: '.symbol',
name: '.name',
category: '[data-category]',
weight: function( itemElem ) {
// remove parenthesis
return parseFloat( $(itemElem).find('.weight').text().replace( /[\(\)]/g, '') );
}
}
});
var options = document.querySelector('#options');
$('#options').on( 'click', 'button', function( event ) {
var isoOptions = {};
var key = $(this).parent().attr('data-isotope-key');
var value = $(this).attr('data-isotope-value');
if ( key == 'filter' && value == 'number-greater-than-50' ) {
// jquery, function used in .each()
value = function( i, elem ) {
return parseInt( $(elem).find('.number').text(), 10 ) > 50;
};
}
// console.log( key, value );
isoOptions[ key ] = value;
$container.isotope( isoOptions );
});
$container.on( 'arrangeComplete', function( event, items ) {
console.log( 'arrangeComplete', items.length );
});
// $container.on( 'hideComplete', function( event, items ) {
// console.log( 'hideComplete', items.length );
// });
});
</script>
</body>
</html>
Loading…
Cancel
Save