polished template
This commit is contained in:
@@ -12,30 +12,31 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
grabCursor: true,
|
||||
on: {
|
||||
slideChange: function () {
|
||||
const realIndex = this.realIndex;
|
||||
const paginationItems = block.querySelectorAll('.pagination-item');
|
||||
|
||||
paginationItems.forEach((item, index) => {
|
||||
const line = item.querySelector('.pagination-line');
|
||||
const text = item.querySelector('.slide-text');
|
||||
|
||||
if (index === realIndex) {
|
||||
item.className = 'pagination-item flex-[2] cursor-pointer transition-all ';
|
||||
line.className = 'pagination-line bg-[#222] h-[2px] rounded-[30px] transition-colors ';
|
||||
text.className = 'slide-text mt-[10px] text-[14px] text-[#222] font-[600] opacity-100 transition-opacity ';
|
||||
} else {
|
||||
item.className = 'pagination-item flex-1 cursor-pointer transition-all ';
|
||||
line.className = 'pagination-line bg-[#e0e0e0] h-[2px] rounded-[30px] transition-colors ';
|
||||
text.className = 'slide-text mt-[10px] text-[14px] text-[#222] font-[600] opacity-0 transition-opacity ';
|
||||
}
|
||||
});
|
||||
updatePagination(block, this.realIndex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Функция обновления пагинации
|
||||
function updatePagination(block, activeIndex) {
|
||||
const paginationItems = block.querySelectorAll('.pagination-item');
|
||||
|
||||
paginationItems.forEach((item, index) => {
|
||||
item.setAttribute('data-active', index === activeIndex ? 'true' : 'false');
|
||||
});
|
||||
}
|
||||
|
||||
// Навигация
|
||||
block.querySelector('.custom-prev')?.addEventListener('click', () => swiper.slidePrev());
|
||||
block.querySelector('.custom-next')?.addEventListener('click', () => swiper.slideNext());
|
||||
const prevBtn = block.querySelector('.custom-prev');
|
||||
const nextBtn = block.querySelector('.custom-next');
|
||||
|
||||
if (prevBtn) {
|
||||
prevBtn.addEventListener('click', () => swiper.slidePrev());
|
||||
}
|
||||
|
||||
if (nextBtn) {
|
||||
nextBtn.addEventListener('click', () => swiper.slideNext());
|
||||
}
|
||||
|
||||
// Пагинация
|
||||
block.querySelectorAll('.pagination-item').forEach((item, index) => {
|
||||
|
||||
Reference in New Issue
Block a user