Filter & sort magical layouts http://isotope.metafizzy.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
14 KiB

/**
* Isotope v1.3.110525
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time license fee
* http://metafizzy.co/#licenses
*
* Copyright 2011 David DeSandro / Metafizzy
*/
(function(a,b,c){var d=function(){function b(b,c){c=c||document.documentElement;var d=c.style,e;if(typeof d[b]=="string")return b;b=b.charAt(0).toUpperCase()+b.slice(1);for(var f=0,g=a.length;f<g;f++){e=a[f]+b;if(typeof d[e]=="string")return e}}var a=["Moz","Webkit","Khtml","O","Ms"];return b}(),e=d("transform"),f=document.documentElement,g=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),h=[{name:"csstransforms",getResult:function(){return!!e}},{name:"csstransforms3d",getResult:function(){var a=!!d("perspective");if(a){var b=document.createElement("style"),c=document.createElement("div"),e="@media ("+g.join("transform-3d),(")+"modernizr)";b.textContent=e+"{#modernizr{height:3px}}",(document.head||document.getElementsByTagName("head")[0]).appendChild(b),c.id="modernizr",f.appendChild(c),a=c.offsetHeight===3,b.parentNode.removeChild(b),c.parentNode.removeChild(c)}return!!a}},{name:"csstransitions",getResult:function(){return!!d("transitionProperty")}}],i,j=h.length;if(a.Modernizr)for(i=0;i<j;i++){var k=h[i];Modernizr.hasOwnProperty(k.name)||Modernizr.addTest(k.name,k.getResult)}else a.Modernizr=function(){var a={_version:"1.6ish: miniModernizr for Isotope"},b=[],c,d,e;for(i=0;i<j;i++)c=h[i],d=c.getResult(),a[c.name]=d,e=(d?"":"no-")+c.name,b.push(e);f.className+=" "+b.join(" ");return a}();if(Modernizr.csstransforms){var l=Modernizr.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},m=function(a,c,d){var f=b.data(a,"isoTransform")||{},g={},h,i={},j;g[c]=d,b.extend(f,g);for(h in f)j=f[h],i[h]=l[h](j);var k=i.translate||"",m=i.scale||"",n=k+m;b.data(a,"isoTransform",f),a.style[e]=n};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){typeof b=="string"&&(b=parseFloat(b)),m(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){m(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var n=b.event,o;n.special.smartresize={setup:function(){b(this).bind("resize",n.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",n.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",o&&clearTimeout(o),o=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c){this.element=b(c),this._create(a),this._init()};var p=["overflow","position","width","height"];b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:Modernizr.csstransforms&&!b.browser.opera?{opacity:0,scale:.001}:{opacity:0},visibleStyle:Modernizr.csstransforms&&!b.browser.opera?{opacity:1,scale:1}:{opacity:1},animationEngine:b.browser.opera?"jquery":"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(c){this.options=b.extend(!0,{},b.Isotope.settings,c),this.styleQueue=[],this.elemCount=0;var d=this.element[0].style;this.originalStyle={};for(var e=0,f=p.length;e<f;e++){var g=p[e];this.originalStyle[g]=d[g]||null}this.element.css({overflow:"hidden",position:"relative"}),this._updateAnimationEngine(),this._updateUsingTransforms();var h={"original-order":function(a,b){return b.elemCount}};this.options.getSortData=b.extend(this.options.getSortData,h),this.reloadItems();var i=b(document.createElement("div")).prependTo(this.element);this.offset=i.position(),i.remove();var j=this;setTimeout(function(){j.element.addClass(j.options.containerClass)},0),this.options.resizable&&b(a).bind("smartresize.isotope",function()