first commit
This commit is contained in:
16
templates/instytut_dendrologii_/js/sortdivcontent.js
Normal file
16
templates/instytut_dendrologii_/js/sortdivcontent.js
Normal file
@@ -0,0 +1,16 @@
|
||||
window.addEventListener('DOMContentLoad', () => {
|
||||
sortDivs();
|
||||
})
|
||||
function sortDivs() {
|
||||
const parentDiv = document.querySelector('div[style="display:flex"]');
|
||||
const divs = Array.from(parentDiv.children);
|
||||
|
||||
divs.sort(function(a, b) {
|
||||
const aNum = parseInt(a.textContent.match(/\d+/)[0]);
|
||||
const bNum = parseInt(b.textContent.match(/\d+/)[0]);
|
||||
|
||||
return aNum - bNum;
|
||||
});
|
||||
|
||||
divs.forEach(div => parentDiv.appendChild(div));
|
||||
}
|
||||
Reference in New Issue
Block a user