DrewDahlman / Mason

Mason.js for creating a perfect grid with jQuery.
http://masonjs.com/
MIT License
1.22k stars 183 forks source link

No-randomised sizes #6

Closed davshoward closed 11 years ago

davshoward commented 11 years ago

Is it possible to have it so that a) the sizes are not randomised but pulled sequentially, and/or b) pull the sizes from the div class rather than defined in jquery?

DrewDahlman commented 11 years ago

because of the use of ratios and dynamica columns mason takes care of the sizing of elements. You can however use the promoted array to force elements of a specific class into a size and it will work around those elements.

$("#my_grid").mason({
    itemSelector: ".box",
    ratio: 1.1,
    sizes: [
        [1,1],
    ],
    promoted:[
        [1,3, 'wide']
        [2,3,'big']
    ]
    filler: {
        itemSelector: '.filler',
        filler_class: 'custom_filler'
    },
    gutter: 3
});

This will result in a grid where wide and big are static sizes based on the ratio, and all other elements will size around them. Filler blocks will still take up the base ratio of 1.1 x 1.