瀏覽代碼

mouse wheel tweaks (closes #454)

Hakim El Hattab 11 年之前
父節點
當前提交
b0b6c75629
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 6 4
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 6 - 4
js/reveal.js

@@ -126,7 +126,7 @@ var Reveal = (function(){
 								'transform' in document.body.style,
 
 		// Throttles mouse wheel navigation
-		mouseWheelTimeout = 0,
+		lastMouseWheelStep = 0,
 
 		// An interval used to automatically move on to the next slide
 		autoSlideTimeout = 0,
@@ -2335,9 +2335,10 @@ var Reveal = (function(){
 	 */
 	function onDocumentMouseScroll( event ) {
 
-		clearTimeout( mouseWheelTimeout );
+		if( Date.now() - lastMouseWheelStep > 600 ) {
+
+			lastMouseWheelStep = Date.now();
 
-		mouseWheelTimeout = setTimeout( function() {
 			var delta = event.detail || -event.wheelDelta;
 			if( delta > 0 ) {
 				navigateNext();
@@ -2345,7 +2346,8 @@ var Reveal = (function(){
 			else {
 				navigatePrev();
 			}
-		}, 100 );
+
+		}
 
 	}
 

File diff suppressed because it is too large
+ 1 - 1
js/reveal.min.js


Some files were not shown because too many files changed in this diff