2

I have been trying to use glidejs in my react project, where I want a function to run after the active slide has changed. I have tried setting an event listener with:

glide.on('move.after', () => {
            console.log('move called')
            this.__changeActiveProject(glide.index)
        })

This way the function is called correctly, but the amount of events that are fired when I swipe the screen creates a huge amount of lag (swiping one item to the left triggers this event listener thousands of times). I have searched through the docs for an event that indicates that the active slide has changed to another slide but I cannot seem to find any event that does what I want. I have tried the move event but this has the same problem.

Is there any event that I can use that indicates that the active slide has changed?

avocadoLambda
  • 1,332
  • 7
  • 16
  • 33
Tyadan
  • 123
  • 1
  • 6

1 Answers1

1

Try out "run"

glide.on('run', () => {
    console.log('move called')
    this.__changeActiveProject(glide.index)
})

Docs here: https://glidejs.com/docs/events/

Ryan Claxton
  • 175
  • 1
  • 2
  • 13