summaryrefslogtreecommitdiff
path: root/themes/blowfish/assets/js/shortcodes/gallery.js
blob: 0c6ac39b6fd78d8f1ab978aa198b1b0e78503926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function _getDefaultPackeryOptions() {
    return {
        percentPosition: true,
        gutter: 5,
        resize: true
    };
}

(function init() {

    $(window).on("load", function () {
        let packeries = [];
        let nodeGalleries = document.querySelectorAll('.gallery');

        nodeGalleries.forEach(nodeGallery => {
            // TODO : implement a reader of Packery configuration _getPackeryOptions; for example by reading data-attribute
            let packery = new Packery(nodeGallery, _getDefaultPackeryOptions());
            packeries.push(packery);
        });
        console.groupEnd();
    });
})();