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

Is there a way to jump to the top of a vertical stack or vice versa to the bottom of the stack? #7

Open
DBIG7 opened this issue Aug 31, 2021 · 2 comments

Comments

@DBIG7
Copy link

DBIG7 commented Aug 31, 2021

Is there a way to jump to the top of a vertical stack or vice versa to the bottom of the stack?

Originally posted by @ericwongmusic in hakimel/reveal.js#3002

@Martinomagnifico
Copy link

Martinomagnifico commented Sep 2, 2021

document.addEventListener('click', function (event) {
	if (event.target.matches('.to-top')) {
		event.preventDefault();
		let currenth = Reveal.getState().indexh;
		Reveal.setState({indexh: currenth, indexv:0})
	} else if (event.target.matches('.to-bottom')) {
		event.preventDefault();
		let currenth = Reveal.getState().indexh;
		let lastnr = (Reveal.getCurrentSlide().parentNode).getElementsByTagName('section').length;
		Reveal.setState({indexh: currenth, indexv:lastnr})
	} else return
}, false);

@Martinomagnifico
Copy link

This is by using some of Reveal's states and methods which are all in the documentation. I think this issue can be closed.

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