I am using the isotope plugin. I am trying to package images in a div. I am having the issues wear the items are not packaging properly and there are large white spaces
There are three size images I am using
- large - 500px
- medium - 250 px
- small - 150px
I am using the following code to initialize
$(window).load(function(){
var $container = $('#item-container');
$container.isotope({
layoutMode: 'masonry',
itemSelector: '.iso-container'
});
});
I know masonry used the first item to determine coulmn width, but no matter if I use the large item first, or the small item. Neither seems to packge together nicely.
Here is the output when I use the smallest image first. The border of the container is in red
I am not sure why the first two items are right next to each other, but then there is a gap between the second and third item (Location Promo (md) 1, Blog Promo (lg) 1)
Here is the result if I put the largest item first
The second image makes more sense to me. Since the large item determines column length, there are only two coulmns for the container. I am not sure why the third item (Video promo (sm1)) isnt next to the second item (Location Promo (md) 1).
Whoops can't see the name on top two items in second picture. i think you are still able to tell what I am discribing.
EDIT: I stumbled across the perfect masonry plugin, I am trying to implement it but I get the error
Cannot read property 'layout' of undefined on this line
this.options.perfectMasonry.layout
EDIT2 I got it working, but it doesnt look any better
new code
$container.isotope({
layoutMode: 'perfectMasonry',
perfectMasonry: {
layout: 'vertical'
},
itemSelector: '.iso-container'
});
EDIT 3
Getting closer.
new code
$container.isotope({
layoutMode: 'perfectMasonry',
perfectMasonry: {
layout: 'vertical',
columnWidth: 20,
rowHeight: 20
},
itemSelector: '.iso-container'
});
new image