浏览代码

fix issue with internal links

hakimel 3 年之前
父节点
当前提交
4e8a1b3802
共有 7 个文件被更改,包括 18 次插入16 次删除
  1. 1 1
      LICENSE
  2. 1 1
      dist/reveal.css
  3. 1 1
      dist/reveal.esm.js
  4. 1 1
      dist/reveal.js
  5. 1 1
      gulpfile.js
  6. 3 2
      index.html
  7. 10 9
      js/reveal.js

+ 1 - 1
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
 of this software and associated documentation files (the "Software"), to deal

文件差异内容过多而无法显示
+ 1 - 1
dist/reveal.css


文件差异内容过多而无法显示
+ 1 - 1
dist/reveal.esm.js


文件差异内容过多而无法显示
+ 1 - 1
dist/reveal.js


+ 1 - 1
gulpfile.js

@@ -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

+ 3 - 2
index.html

@@ -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>

+ 10 - 9
js/reveal.js

@@ -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 ) {
 
@@ -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();
 			}
 		}
 

部分文件因为文件数量过多而无法显示