If you are looking to create a right-to-left layout that includes images in your content, such as Bootstrap cards with images, then utilize the following code snippet for assistance.
Note: To implement this, make sure to have both Masonry and imagesLoaded libraries:
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
//For more information, refer to the documentation: https://masonry.desandro.com/layout.html#imagesloaded
//Check out the demo here: https://codepen.io/desandro/pen/MwJoLQ
var grid = document.querySelector('.masonry');
var msnry;
imagesLoaded(grid, function () {
// Initialize Masonry after all images have loaded
msnry = new Masonry(grid, {
// options
percentPosition: true,
originLeft: false
});
});
Furthermore, due to the removal of Masonry from Bootstrap 5, the above instructions can serve as a helpful reference for those interested.