🐛 : Shortcodes gallery (non-unique id, multiple loading <script> tag)

This commit is contained in:
v20100v
2023-12-18 14:37:47 +01:00
parent b6744efbf2
commit c790396863
5 changed files with 37 additions and 17 deletions
+24
View File
@@ -0,0 +1,24 @@
function _getDefaultPackeryOptions() {
return {
percentPosition: true,
gutter: 5,
resize: true
};
}
(function init() {
window.addEventListener("DOMContentLoaded", (event) => {
console.groupCollapsed('[DEBUG] Gallery feature enable');
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.log("Galleries founded and initialized with packery", packeries);
console.groupEnd();
});
})();