Skip to content

Instantly share code, notes, and snippets.

View ibanner's full-sized avatar

Itay Banner ibanner

  • Rehovot, ISRAEL
View GitHub Profile
@ibanner
ibanner / masonry-alm.js
Created December 21, 2016 10:31
This is what I'm trying to use now, but still I get the same layout in RTL as in LTR.
var x = document.getElementsByTagName("html")[0].getAttribute("dir");
jQuery(function() {
var masonryInit = true; // set Masonry init flag
jQuery.fn.almComplete = function(alm){ // Ajax Load More callback function
if(jQuery('#masonry-grid').length){
var $container = jQuery('#masonry-grid ul'); // our container
if(masonryInit){
// initialize Masonry only once
masonryInit = false;
@ibanner
ibanner / masonry-grid.js
Created December 21, 2016 10:29
Before ALM, this is what I used and worked fine.
var x = document.getElementsByTagName("html")[0].getAttribute("dir");
// console.log(x);
if ( x == 'rtl') {
jQuery('.grid').masonry({
itemSelector: '.grid-item',
columnWidth: '.grid-item',
percentPosition: true,
originLeft: false,
resizesContainer: true