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

Not clear on how to use data-steps attribute on a slide #160

Open
bentorkington opened this issue Dec 22, 2023 · 5 comments
Open

Not clear on how to use data-steps attribute on a slide #160

bentorkington opened this issue Dec 22, 2023 · 5 comments

Comments

@bentorkington
Copy link

bentorkington commented Dec 22, 2023

Background: I want to add a WebGL canvas to one of my slides, and cue different phases of an animation when I use the arrow keys to proceed to the next slide. Clearly it's not desirable to use separate slides for this, but to do something similar to what delayed-children does.

Looking over the source I've found a data-steps attribute that I can use to assign a number of steps to a slide, but I'm not sure how its supposed to be used. I see that it must be set to an integer, and doing so creates a number of <span> elements that progressively have displayed added to their class, but I don't understand what these elements are supposed to do, and there doesn't seem to be anything demonstrating the feature in the example slide deck.

Furthermore, I was hoping to hook into the slidechange event to trigger different phases of the animation, but this only fires for a complete slide change, not for progressive changes on a slide with delayed-children or data-steps.

I suppose I could use DOM Mutation Observers to watch these changes to these dummy elements, but this seems unwieldy as I'd need to find the child index of each to know which one was just displayed.

At this point I thought I'd ask the community what I might be missing about data-steps, and if there's an opportunity for a feature to fire an event as each of these steps are progressed through, which I'd be happy to submit a PR for. Thoughts?

@LeaVerou
Copy link
Owner

Yeah unfortunately this was primarily intended for slide effects that can be coded with CSS attribute selectors. Ideally Inspire.js should also fire events for this (e.g. step), just like it fires slidechange events. Happy to accept a PR for this!

@bentorkington
Copy link
Author

Whoops! I found the gotoitem-end hook (but there's no classical event) which I can use for my purposes. Once I've finished putting my talk together I'll add a classical event and edit the readme.md

@LeaVerou
Copy link
Owner

The irony: I needed this myself just now, and had to look up your post to remember how to do it 🤣 And I coded the thing!

@LeaVerou
Copy link
Owner

Just pushed an experimental change for an itemcurrent event, if you do get to try it out, please let me know how it worked! Not closing this yet, as the docs are still needed…

@bentorkington
Copy link
Author

well would you look at that, something else I said I was gonna do and didn't get around to. Thanks Lea

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

2 participants