57
rated 0 times
[
64]
[
7]
/ answers: 1 / hits: 8439
/ 5 Years ago, sun, october 6, 2019, 12:00:00
I'm trying to display a horizontal timeline on my HTML page. I'm having trouble with my swiper slider, the next and prev buttons do not work at all, I've included the library as well, still doesn't work, I don't understand why. No errors are shown in console, buttons are clickable but do not function at all. How do I fix this? Below is the code
<div id=app class=container>
<div class=row>
<div class=col-md-12>
<div class=swiper-container>
<p class=swiper-control>
<button type=button class=btn btn-default btn-sm prev-slide>Prev</button>
<button type=button class=btn btn-default btn-sm next-slide>Next</button>
</p>
<div class=swiper-wrapper timeline>
<div class=swiper-slide v-for=item in steps>
<div class=timestamp>
<span class=date>{{item.dateLabel}}<span>
</div>
<div class=status>
<span>{{item.title}}</span>
</div>
</div>
</div>
<!-- Add Pagination -->
<div class=swiper-pagination></div>
</div>
</div>
</div>
</div>
<script src=https://cdn.jsdelivr.net/npm/[email protected]></script>
<script>
const data = [{
dateLabel: 'January 2017',
title: 'Gathering Information'
},
{
dateLabel: 'February 2017',
title: 'Planning'
},
{
dateLabel: 'March 2017',
title: 'Design'
},
{
dateLabel: 'April 2017',
title: 'Content Writing and Assembly'
},
{
dateLabel: 'May 2017',
title: 'Coding'
},
{
dateLabel: 'June 2017',
title: 'Testing, Review & Launch'
},
{
dateLabel: 'July 2017',
title: 'Maintenance'
}
];
new Vue({
el: '#app',
data: {
steps: data,
},
mounted() {
var swiper = new Swiper('.swiper-container', {
slidesPerView: 4,
paginationClickable: true,
grabCursor: true,
paginationClickable: true,
nextButton: '.next-slide',
prevButton: '.prev-slide',
});
}
})
More From » html