created 3 blocks
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
const carouselItems = document.querySelectorAll('#multiItemCarousel .carousel-item');
|
||||
|
||||
carouselItems.forEach((el) => {
|
||||
// Количество элементов, видимых одновременно на экране (col-md-3 = 4 элемента)
|
||||
const minPerSlide = 4;
|
||||
let next = el.nextElementSibling;
|
||||
|
||||
for (let i = 1; i < minPerSlide; i++) {
|
||||
// Если элементы закончились, берем первый с начала для бесконечного цикла
|
||||
if (!next) {
|
||||
next = carouselItems[0];
|
||||
}
|
||||
|
||||
// Клонируем первый дочерний элемент (нашу колонку col-md-3)
|
||||
let cloneChild = next.cloneNode(true);
|
||||
el.appendChild(cloneChild.children[0]);
|
||||
next = next.nextElementSibling;
|
||||
}
|
||||
});
|
||||
*/
|
||||
Reference in New Issue
Block a user