Skip to content

Commit

Permalink
fix slider
Browse files Browse the repository at this point in the history
  • Loading branch information
loomchild committed May 29, 2021
1 parent 30068f8 commit 633ab8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ function Slider ({ el } = {}) { // eslint-disable-line no-unused-vars
}

Webflow.push(() => {
const dots = document.querySelectorAll(`${this.el} .w-slider-dot`)
const dots = this.el.querySelectorAll('.w-slider-dot')
this.slideCount = dots.length
dots.forEach((dot, index) => {
setObserver(dot, index)
})
})

this.$watch('slide', (index) => {
const dot = document.querySelector(`${this.el} .w-slider-dot:nth-child(${index + 1})`)
const dot = this.el.querySelector(`.w-slider-dot:nth-child(${index + 1})`)
if (dot && !dot.classList.contains('w-active')) {
dot.dispatchEvent(new MouseEvent('click', { view: window, bubbles: true, cancelable: true }))
}
Expand Down

0 comments on commit 633ab8f

Please sign in to comment.