Skip to content

Commit

Permalink
fix issue with internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Nov 11, 2021
1 parent ad46e62 commit 4e8a1b3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion dist/reveal.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.esm.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const banner = `/*!
* ${pkg.homepage}
* MIT licensed
*
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
* Copyright (C) 2011-2021 Hakim El Hattab, https://hakim.se
*/\n`

// Prevents warnings from opening too many test pages
Expand Down
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
<body>
<div class="reveal">
<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>
</div>
</div>
</div>213.244.242.6

<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
Expand Down
19 changes: 10 additions & 9 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const VERSION = '4.1.3';
* https://revealjs.com
* 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 ) {

Expand Down Expand Up @@ -2384,19 +2384,20 @@ export default function( revealElement, options ) {
*/
function onSlidesClicked( event ) {

const anchor = Util.closest( event.target, 'a[href^="#"]' );

// If a hash link is clicked, we find the target slide
// and navigate to it. We previously relied on 'hashchange'
// for links like these but that prevented media with
// audio tracks from playing in mobile browsers since it
// wasn't considered a direct interaction with the document.
if( event.target.nodeName === 'A' ) {
const hash = event.target.getAttribute( 'href' );
if( /^#/.test( hash ) ) {
const indices = location.getIndicesFromHash( hash );
if( indices ) {
Reveal.slide( indices.h, indices.v, indices.f );
event.preventDefault();
}
if( anchor ) {
const hash = anchor.getAttribute( 'href' );
const indices = location.getIndicesFromHash( hash );

if( indices ) {
Reveal.slide( indices.h, indices.v, indices.f );
event.preventDefault();
}
}

Expand Down

0 comments on commit 4e8a1b3

Please sign in to comment.