Event for slideChange
Hi everyone, 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?
I was looking for the same event. Seems this is implemented by the run event:
glide.on('run.after', () => { this.__changeActiveProject(glide.index) })
run.before Arguments:
{Object} move Called right before calculating new index and making a transition. The movement schema (eg. =1) string has been parsed.
run Arguments:
{Object} move Called right after calculating new index and before making a transition. The movement schema (eg. =1) string has been parsed.
run.after Arguments:
{Object} move Called after calculating new index and making a transition. The movement schema (eg. =1) string has been parsed.
From the documentation: https://glidejs.com/docs/events/