Created
December 21, 2016 10:31
-
-
Save ibanner/5d18983d9c4da40b6339c69ed0d9b64f to your computer and use it in GitHub Desktop.
This is what I'm trying to use now, but still I get the same layout in RTL as in LTR.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
if ( x == 'rtl') { | |
$container.masonry({ | |
itemSelector: '.grid-item', | |
columnWidth: '.grid-item', | |
percentPosition: true, | |
resizesContainer: true, | |
originLeft: false, | |
isRTL: true | |
}); | |
console.log('RTL detected'); | |
} else { | |
$container.masonry({ | |
itemSelector: '.grid-item', | |
columnWidth: '.grid-item', | |
percentPosition: true, | |
resizesContainer: true | |
}); | |
console.log('RTL not detected'); | |
} | |
}else{ | |
$container.masonry('reloadItems'); // Reload masonry items after callback | |
} | |
$container.imagesLoaded( function() { // When images are loaded, fire masonry again. | |
$container.masonry(); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment