Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Before change hooks #3003

Closed
elliotlings opened this issue Sep 7, 2021 · 4 comments
Closed

Before change hooks #3003

elliotlings opened this issue Sep 7, 2021 · 4 comments

Comments

@elliotlings
Copy link

Is it possible to add a before slide change hook, so that you can stop a slide change doing it's default functionality and move to a different a slide entirely?

@hakimel
Copy link
Owner

hakimel commented Sep 16, 2021

I've wanted a preventable event like this myself in the past. Just pushed a first iteration of it to master.

// This will prevent all slide changes
Reveal.addEventListener( 'slidechange', e => e.preventDefault() )

What should this event be called? slidechange might be too similar to slidechanged which is dispatched after. Perhaps beforeslidechanged?

@Martinomagnifico
Copy link
Collaborator

beforeslidechanged sounds good to me. Maybe even beforeslidechange, because if a 'change' takes time, it would mean that the slide could have already started changing, but not finished changing. (which is more like slidetransitionend)

@hakimel
Copy link
Owner

hakimel commented Sep 20, 2021

I've renamed to beforeslidechange. Will add it to the docs once when the next release goes out.

@Medioman92
Copy link

it would be great if there was information about the direction in the event. Something like:
slideChangeDirection:'left' or slideChangeDirection:'right' slideChangeDirection:'up' or slideChangeDirection:'down'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants