Permalink
Browse files

Added support for a countdown

  • Loading branch information...
christeredvartsen committed Jun 13, 2012
1 parent 56f017f commit e543305dfcb5e603333128da55b1727d6ddac1fa
Showing with 51 additions and 6 deletions.
  1. +18 −0 deck.ignite.css
  2. +4 −0 deck.ignite.html
  3. +29 −6 deck.ignite.js
View
@@ -0,0 +1,18 @@
+.deck-container .deck-ignite{
+ position: absolute;
+ bottom: 40px;
+ right: 15px;
+ color: #aaa;
+ z-index: 3;
+ margin: 0;
+}
+
+body.deck-container .deck-ignite {
+ position: fixed;
+}
+
+@media print {
+ .deck-ignite {
+ display: none;
+ }
+}
View
@@ -0,0 +1,4 @@
+<!-- deck.ignite snippet -->
+<p class="deck-ignite">
+ <span class="deck-ignite-countdown"></span>
+</p>
View
@@ -1,12 +1,12 @@
/*!
-An extension for deck.js to run as presentation as an ignite
-presentation. Each slide will be shown for 15 seconds before the
+An extension for deck.js to run a presentation as an ignite
+presentation. Each slide will be shown for 15 seconds before the
slide deck changes to the next slide automagically.
The first slide will be shown until the presentation is started,
and the last slide will end the show. Any manual navigation during
the slide show will cancel ignite mode, until a slide has been shown
-for at least 15 seconds. The next forward move will yet again start
+for at least 15 seconds. The next forward move will yet again start
the slide deck in ignite mode.
Copyright (c) 2012 Mats Lindh
@@ -20,15 +20,27 @@ Runs a slide deck in ignite mode
var lastChange = 0;
var igniteActive = false;
var intervalTimer = null;
+ var countdownTimer = null;
$.extend(true, $[deck].defaults, {
- igniteDelay: 15
+ igniteDelay: 15,
+ showCountdown: false,
+ selectors: {
+ countdown: '.deck-ignite-countdown'
+ }
});
-
+
$(document).bind('deck.change', function(event, from, to) {
function stopIgniteMode()
{
igniteActive = false;
+
+ if (opts.showCountdown)
+ {
+ $(opts.selectors.countdown).text('');
+ clearInterval(countdownTimer);
+ }
+
clearInterval(intervalTimer);
}
@@ -50,8 +62,20 @@ Runs a slide deck in ignite mode
if (!igniteActive && ((currentTime - lastChange) >= (opts.igniteDelay * 1000)))
{
igniteActive = true;
+
+ if (opts.showCountdown)
+ {
+ timeLeft = opts.igniteDelay - 1;
+
+ countdownTimer = setInterval(function() {
+ $(opts.selectors.countdown).text(timeLeft);
+ timeLeft -= 1;
+ }, 1000);
+ }
+
intervalTimer = setInterval(function() {
$[deck]('next');
+ timeLeft = opts.igniteDelay;
}, opts.igniteDelay * 1000);
}
}
@@ -68,4 +92,3 @@ Runs a slide deck in ignite mode
}
});
})(jQuery, 'deck');
-

0 comments on commit e543305

Please sign in to comment.