Intersections

Vertical grid

Intersections:

false
true

Align:

top
center
bottom

Append:

1 item
10 items
clear

Notice: (Both grid items are draggable with 'intersection' dragifier mode.)

Horizontal grid

Intersections:

false
true

Align:

left
center
right

Append:

1 item
10 items
clear

Intersection types

How to select insersection algorithm?

By default, grid items can intersect each other vertically and horizontally any number of times. To change insersection algorithm use 'intersections' setting:

intersections: true
setting, used by default

vertical grid
Any amount of items can intersect any other item horizontally.

horizontal grid
Any amount of items can intersect any other item vertically.

intersections: false
setting, custom

vertical grid
Only one item can intersect any other item horizontally.

horizontal grid
Only one item can intersect any other item vertically.

Notice.
If you will pass 'align' setting with any of available values, 'no' value of 'intersections' setting will be selected automatically.

How to dynamically change intersection type?

set("intersections", true).reposition()
set("intersections", false).reposition()

Aligns

How to select dynamic items alignment inside grid?

You can select one of the following types of alignment with vertical grids:

align: "top"
setting, used by default
align: "center"
setting, custom
align: "bottom"
setting, custom

Following values are available with horizontal grids:

align: "left"
setting, used by default
align: "center"
setting, custom
align: "right"
setting, custom

Notice.
If you will pass 'align' setting with any of available values, 'intersections' = 'no' will be selected automatically.

How to dynamically change alignment type?

set("align", "center").reposition()
Insersection settings usage examples:

var demoGrid = document.getElementById("#demo-grid");
var settings = {
    // This parameter can be omitted, if you are passing align param.
    // With false value, 'top' align per vertical grid
    // or 'left' align per horizontal grid will be used by default.
    intersections: true|false,

    // Passing this parameter enables noIntersections strategy.
    align: "top|center|bottom|left|right",

    // Usage of 'center|bottom|right' aligns can cause some
    // item 'jumps' on grid repositions in rare cases.(Explained in next section)
    // To fix it, you can increase reposition queue size:
    queueSize: 40
};

var grid = new Gridifier(demoGrid, settings);
        
Using dynamic setters

// Enable intersections and retransform grid
grid.set("intersections", true).reposition();

// Disable intersections and retransform grid
grid.set("intersections", false).reposition();

// Select new alignment type and retransform grid
grid.set("align", "center").reposition();
        

No intersections

What should you know about no intersections mode?


Reposition queue side-effect

Why in some cases some items 'are jumping' before correct align?


So, the 'jump' happens because of dynamic aligns nature and queue-based kernel.

How to avoid jumps?

queueSize: 40
setting, default value = 12
Example from this page demo:

// ... Page code
var verticalGridDemo = new Gridifier(demoGrid, settings);

TouchClickEvent.listen(selectTopAlignButton, function() {
    // Jumps can't happen with default align value('top'),
    // so default value = 12 is enough
    verticalGridDemo.set("queueSize", 12).set("align", "top").reposition();
});

// Setting batchSize to 40 will be enough per most cases.
TouchClickEvent.listen(selectCenterAlignButton, function() {
    verticalGridDemo.set("queueSize", 40).set("align", "center").reposition();
}

TouchClickEvent.listen(selectBottomAlignButton, function() {
    verticalGridDemo.set("queueSize", 40).set("align", "bottom").reposition();
}
// ... Similiar code per horizontal grid demo
        
next: Sizes transforms prev: Insert types
Ξ
GRIDIFIER.IO
x