Browse Source

prevent overview click events after calling Reveal.removeEventListeners

Hakim El Hattab 11 năm trước cách đây
mục cha
commit
40759435e4
2 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 8 1
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 8 - 1
js/reveal.js

@@ -129,6 +129,9 @@ var Reveal = (function(){
 		// A delay used to deactivate the overview mode
 		deactivateOverviewTimeout = 0,
 
+		// Flags if the interaction event listeners are bound
+		eventsAreBound = false,
+
 		// Holds information about the currently ongoing touch input
 		touch = {
 			startX: 0,
@@ -390,6 +393,8 @@ var Reveal = (function(){
 	 */
 	function addEventListeners() {
 
+		eventsAreBound = true;
+
 		window.addEventListener( 'hashchange', onWindowHashChange, false );
 		window.addEventListener( 'resize', onWindowResize, false );
 
@@ -424,6 +429,8 @@ var Reveal = (function(){
 	 */
 	function removeEventListeners() {
 
+		eventsAreBound = false;
+
 		document.removeEventListener( 'keydown', onDocumentKeyDown, false );
 		window.removeEventListener( 'hashchange', onWindowHashChange, false );
 		window.removeEventListener( 'resize', onWindowResize, false );
@@ -1801,7 +1808,7 @@ var Reveal = (function(){
 
 		// TODO There's a bug here where the event listeners are not
 		// removed after deactivating the overview.
-		if( isOverview() ) {
+		if( eventsAreBound && isOverview() ) {
 			event.preventDefault();
 
 			deactivateOverview();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
js/reveal.min.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác