Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from christeredvartsen/countdown

Added support for a countdown
  • Loading branch information...
commit 3cbf4d33bd7935e1392e867e9ca713825486809d 2 parents 56f017f + e543305
@matslindh authored
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
18 deck.ignite.css
@@ -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
4 deck.ignite.html
@@ -0,0 +1,4 @@
+<!-- deck.ignite snippet -->
+<p class="deck-ignite">
+ <span class="deck-ignite-countdown"></span>
+</p>
View
35 deck.ignite.js
@@ -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');
-
Please sign in to comment.
Something went wrong with that request. Please try again.