You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.4 KiB
1.4 KiB
sidebar_position |
---|
3 |
How column widths work
There are 4 options for defining the width of the columns:
-
Use a sizer element. This is the easiest way to specify column and gutter widths. Add the sizer element and make it 1 column wide. Shuffle will measure the
width
andmargin-left
of thissizer
element each time the grid resizes. This is awesome for responsive or fluid grids where the width of a column is a percentage.const shuffleInstance = new Shuffle(element, { itemSelector: '.picture-item', // highlight-next-line sizer: '.js-shuffle-sizer', });
-
Use a function. When a function is used, its first parameter will be the width of the shuffle element. You need to return the column width for shuffle to use (in pixels).
const shuffleInstance = new Shuffle(element, { itemSelector: '.picture-item', // highlight-next-line columnWidth: (containerWidth) => 0.18 * containerWidth, });
-
A number. This will explicitly set the column width to your number (in pixels).
const shuffleInstance = new Shuffle(element, { itemSelector: '.picture-item', // highlight-next-line columnWidth: 200, });
-
By default, shuffle will use the width of the first item to calculate the column width.
const shuffleInstance = new Shuffle(element, { itemSelector: '.picture-item', });