1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-10-24 19:56:22 +02:00

suport data-id for slide links

This commit is contained in:
Hakim El Hattab
2025-10-14 11:57:25 +02:00
parent 6dbfd7e718
commit 662c73453e
6 changed files with 32 additions and 8 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,27 @@
<div class="reveal"> <div class="reveal">
<div class="slides"> <div class="slides">
<section>Slide 1</section> <section>Slide 1</section>
<section>
<div id="debug-text"></div>
<div class="r-hstack">
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
</div>
<div class="r-hstack">
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
</div>
<div class="r-hstack">
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" width="200px" data-autoplay></video>
</div>
</section>
<section>Slide 2</section> <section>Slide 2</section>
<section><iframe data-src="https://www.verysecureserver4u.com/en/passwords/jonas21.8"></iframe></section>
<section><iframe data-src="https://www.verysecureserver4u.com/en"></iframe></section>
</div> </div>
</div> </div>
@@ -32,6 +52,8 @@
Reveal.initialize({ Reveal.initialize({
hash: true, hash: true,
scrollActivationWidth: 0,
// Learn about plugins: https://revealjs.com/plugins/ // Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ] plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
}); });

View File

@@ -60,11 +60,13 @@ export default class Location {
name = name.split( '/' ).shift(); name = name.split( '/' ).shift();
} }
// Ensure the named link is a valid HTML ID attribute // Ensure the named link is a valid HTML id or data-id attribute
try { try {
slide = document const decodedName = decodeURIComponent( name );
.getElementById( decodeURIComponent( name ) ) slide = (
.closest('.slides section'); document.getElementById( decodedName ) ||
document.querySelector( `[data-id="${decodedName}"]` )
).closest('.slides section');
} }
catch ( error ) { } catch ( error ) { }