aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaugtur <naugtur@gmail.com>2012-01-15 00:34:51 +0100
committerNaugtur <naugtur@gmail.com>2012-01-15 00:34:51 +0100
commit2ae803efb6659474c61e4dba885bf6a5abf814fe (patch)
treeadb3a57425f3cf25f28a080590238bb8dcac37ba
parent401c554c8001a6c444c1e70d5e5cd728d7740b38 (diff)
downloadperl-software-in-gnu-guix-2ae803efb6659474c61e4dba885bf6a5abf814fe.tar
perl-software-in-gnu-guix-2ae803efb6659474c61e4dba885bf6a5abf814fe.tar.gz
Added support for smart scrolling through slides. Scrolling events are throttled to prevent going too far
-rw-r--r--js/reveal.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 75d3141..88d201a 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -173,6 +173,11 @@ var Reveal = (function(){
// Add some 3D magic to our anchors
linkify();
}
+
+ //bind scrolling
+ if(window.addEventListener){
+ document.addEventListener('DOMMouseScroll', scrollStep, false);
+ }
// Read the initial hash
readURL();
@@ -676,6 +681,26 @@ var Reveal = (function(){
}
}
+ var stepT=0;
+ function scrollStep(e){
+ clearTimeout(stepT);
+ stepT=setTimeout(function(){
+ if(e.detail>0){
+ if(availableRoutes().down){
+ navigateDown()
+ }else{
+ navigateRight()
+ }
+ }else{
+ if(availableRoutes().up){
+ navigateUp()
+ }else{
+ navigateLeft()
+ }
+ }
+ },200);
+ }
+
// Expose some methods publicly
return {
initialize: initialize,