fix issue with internal links
This commit is contained in:
parent
ad46e6293c
commit
4e8a1b3802
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright (C) 2020 Hakim El Hattab, http://hakim.se, and reveal.js contributors
|
Copyright (C) 2011-2021 Hakim El Hattab, http://hakim.se, and reveal.js contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@ const banner = `/*!
|
||||||
* ${pkg.homepage}
|
* ${pkg.homepage}
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
|
* Copyright (C) 2011-2021 Hakim El Hattab, https://hakim.se
|
||||||
*/\n`
|
*/\n`
|
||||||
|
|
||||||
// Prevents warnings from opening too many test pages
|
// Prevents warnings from opening too many test pages
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="reveal">
|
<div class="reveal">
|
||||||
<div class="slides">
|
<div class="slides">
|
||||||
<section>Slide 1</section>
|
<section><a href="#video">Slide 1</a></section>
|
||||||
|
<section id="video"><video data-autoplay src="https://s3.amazonaws.com/media-d.slid.es/videos/1/JPP5wXr1/big_buck_bunny.mp4"></section>
|
||||||
<section>Slide 2</section>
|
<section>Slide 2</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>213.244.242.6
|
||||||
|
|
||||||
<script src="dist/reveal.js"></script>
|
<script src="dist/reveal.js"></script>
|
||||||
<script src="plugin/notes/notes.js"></script>
|
<script src="plugin/notes/notes.js"></script>
|
||||||
|
|
19
js/reveal.js
19
js/reveal.js
|
@ -33,7 +33,7 @@ export const VERSION = '4.1.3';
|
||||||
* https://revealjs.com
|
* https://revealjs.com
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
|
* Copyright (C) 2011-2021 Hakim El Hattab, https://hakim.se
|
||||||
*/
|
*/
|
||||||
export default function( revealElement, options ) {
|
export default function( revealElement, options ) {
|
||||||
|
|
||||||
|
@ -2384,19 +2384,20 @@ export default function( revealElement, options ) {
|
||||||
*/
|
*/
|
||||||
function onSlidesClicked( event ) {
|
function onSlidesClicked( event ) {
|
||||||
|
|
||||||
|
const anchor = Util.closest( event.target, 'a[href^="#"]' );
|
||||||
|
|
||||||
// If a hash link is clicked, we find the target slide
|
// If a hash link is clicked, we find the target slide
|
||||||
// and navigate to it. We previously relied on 'hashchange'
|
// and navigate to it. We previously relied on 'hashchange'
|
||||||
// for links like these but that prevented media with
|
// for links like these but that prevented media with
|
||||||
// audio tracks from playing in mobile browsers since it
|
// audio tracks from playing in mobile browsers since it
|
||||||
// wasn't considered a direct interaction with the document.
|
// wasn't considered a direct interaction with the document.
|
||||||
if( event.target.nodeName === 'A' ) {
|
if( anchor ) {
|
||||||
const hash = event.target.getAttribute( 'href' );
|
const hash = anchor.getAttribute( 'href' );
|
||||||
if( /^#/.test( hash ) ) {
|
const indices = location.getIndicesFromHash( hash );
|
||||||
const indices = location.getIndicesFromHash( hash );
|
|
||||||
if( indices ) {
|
if( indices ) {
|
||||||
Reveal.slide( indices.h, indices.v, indices.f );
|
Reveal.slide( indices.h, indices.v, indices.f );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue