JavaScript
- 8 ответов
- 0 вопросов
12
Вклад в тег
<ul class="swiper-menu">
<li class="swiper-menu__item" data-index="0">Каталог продукции</li>
<li class="swiper-menu__item" data-index="1">О нашей компании</li>
<li class="swiper-menu__item" data-index="2">Контактная информация</li>
<li class="swiper-menu__item" data-index="3">Категория</li>
<ul>
const mySwiper = new Swiper('swiper-container', {
mode:'horizontal',
loop: false,
pagination: {
el: '.swiper-pagination',
type: 'progressbar',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
})
$('.swiper-menu').on('click', '.swiper-menu__item', function() {
const index = $(this).data('index')
mySwiper.slideTo(index)
});
const fetchItems = async () => {
const data = await fetch('https://faap-app.herokuapp.com/faap/v1/rcvr_board'
);
const json = await data.json();
setItems(json.data);
};
return (
<div>
{items && items.map(item => (
<h1 key={item.id}>{item.subject}</h1>
))}
</div>
);