Skip to content
Snippets Groups Projects
Commit 27ff1996 authored by Thomas Fritsch's avatar Thomas Fritsch
Browse files

add support for links to the id of an element nested inside slide

fixes hakimel/reveal.js#3231
parent c8a7f262
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ export default class Location {
// If the first bit is not fully numeric and there is a name we
// can assume that this is a named link
if( !/^[0-9]*$/.test( bits[0] ) && name.length ) {
let element;
let slide;
let f;
......@@ -62,12 +62,14 @@ export default class Location {
// Ensure the named link is a valid HTML ID attribute
try {
element = document.getElementById( decodeURIComponent( name ) );
slide = document
.getElementById( decodeURIComponent( name ) )
.closest('.slides>section, .slides>section>section');
}
catch ( error ) { }
if( element ) {
return { ...this.Reveal.getIndices( element ), f };
if( slide ) {
return { ...this.Reveal.getIndices( slide ), f };
}
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment