Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bone101: add autoadvance feature

  • Loading branch information...
commit ccb2c05c51599659556dc1d3f4702a01f5760a3c 1 parent b077cdd
@jadonk authored
Showing with 33 additions and 0 deletions.
  1. +32 −0 bone101/autoadvance.js
  2. +1 −0  bone101/index.html
View
32 bone101/autoadvance.js
@@ -0,0 +1,32 @@
+autoAdvanceTimeout = null;
+autoAdvanceDuration = 400;
+
+autoAdvance = function() {
+ if(w3c_slidy.slide_number < w3c_slidy.slides.length - 1) {
+ w3c_slidy.next_slide(true);
+ } else {
+ w3c_slidy.first_slide();
+ }
+ autoAdvanceTimeout = setTimeout(autoAdvance, autoAdvanceDuration);
+ return w3c_slidy.cancel(event);
+};
+
+disableAutoAdvance = function() {
+ if(autoAdvanceTimeout) clearTimeout(autoAdvanceTimeout);
+ autoAdvanceTimeout = null;
+};
+
+enableAutoAdvance = function() {
+ autoAdvanceTimeout = setTimeout(autoAdvance, autoAdvanceDuration);
+};
+
+onAutoAdvanceKeyPress = function(event) {
+ // disable on any keypress (reload to restart autoAdvance)
+ if(autoAdvanceTimeout) {
+ disableAutoAdvanceTimeout();
+ }
+}
+
+document.addEventListener("keypress", onAutoAdvanceKeyPress, false);
+
+enableAutoAdvance();
View
1  bone101/index.html
@@ -6,6 +6,7 @@
<title>BeagleBoard 101</title>
<link rel="stylesheet" type="text/css" media="screen, projection, print" href="slidy.css" />
<script src="slidy.js" charset="utf-8" type="text/javascript"></script>
+ <script src="autoadvance.js" charset="utf-8" type="text/javascript"></script>
<!-- source: http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css -->
<!-- source: http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js -->
<link rel="stylesheet" type="text/css" media="screen, projection, print" href="beagle.css" />
Please sign in to comment.
Something went wrong with that request. Please try again.