consul/website/source/assets/javascripts/consul-connect/application.js

40 lines
902 B
JavaScript
Raw Normal View History

2018-06-19 22:48:56 +00:00
var dots = document.querySelectorAll('.g-carousel .pagination li')
if (document.querySelector('.siema')) {
var carousel = new Siema({
selector: '.siema',
duration: 200,
easing: 'ease-out',
perPage: 1,
startIndex: 0,
draggable: true,
multipleDrag: true,
threshold: 20,
loop: true,
rtl: false,
onChange: () => {
for (var i = 0; i < dots.length; i++) {
dots[i].classList.remove('active')
}
dots[carousel.currentSlide].classList.add('active')
}
2018-06-19 22:48:56 +00:00
})
2018-06-19 22:48:56 +00:00
document
.querySelector('.g-carousel .prev')
.addEventListener('click', function() {
carousel.prev()
})
2018-06-19 22:48:56 +00:00
document
.querySelector('.g-carousel .next')
.addEventListener('click', function() {
carousel.next()
})
2018-06-19 22:48:56 +00:00
for (let i = 0; i < dots.length; i++) {
dots[i].addEventListener('click', function() {
carousel.goTo(i)
})
}
}