How can I override to automatic left-alignment in the beautiful-beautiful jQuery Isotope (Source on GitHub)?
Thanks!
How can I override to automatic left-alignment in the beautiful-beautiful jQuery Isotope (Source on GitHub)?
Thanks!
You have two options: Re-engineer Isotope's layout logic, or build your own layout mode.
Isotope's layout logic is progressively enhanced to use CSS transforms when available, but fall back to top/left positioning. So if you pass in coordinates x, y to the getPositionStyles
method it will either return with { translate: [ x, y ] }
or { left: x; top: y }
. The problem with right-to-left layouts is that it would work with { right: x; top: y }
, but it would break with the CSS transform equivalent.
Building your own layout mode might be the more accessible route. Eventually I need to write the docs as to how to develop your own custom layout mode. But you might able to do it yourself by reading the source. You'll find that each layout mode is broken up into 4 required methods _layoutnameReset
, _layoutnameLayout
_layoutnameGetContainerSize
and _layoutnameResize
.
I have opened an issue on GitHub so you can track status on this feature request.
sometimes commercial themes (in my case a wordpress theme) include the jquery isotope ,and then to make it right to left you need to make these changes in another file - had to change not the jquery.isotope.js but the jquery.isotope.min.js file .
1 first use find to search for the terms (ctrl f) "positionAbs" you will find
"_positionAbs:function(a,b){return{left:a,top:b}" replace it with this
"_positionAbs:function(a,b){return{right:a,top:b}"
2 use find to search for the terms (ctrl f) "transformsEnabled" you will find " transformsEnabled:!0" replace it with this
" transformsEnabled:!1"
3 change the style css as mentioned in the previous answers.
first: you must selet isotop tag then isOriginLeft: false
for example: $(".isotopeContainer").isotope({ isOriginLeft: false });
just change 3 lines of isotope package at method Item.prototype.getPosition
if didn't find it at the same lines just search about Item.prototype.getPosition
that's it and it will work
in jquery.isotop.min.js file just replace:
this.usingTransforms&&(d.left=0,d.top=0)
with:
this.usingTransforms&&(d.right=0,d.top=0)
And:
translate3d("+a[0]+"px, "+a[1]+"px, 0),
translate("+a[0]+"px, "+a[1]+"px)
with:
translate3d("+(-a[0])+"px, "+a[1]+"px, 0)
translate("+(-a[0])+"px, "+a[1]+"px)