Skip to content

Commit

Permalink
Added support for a countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Jun 13, 2012
1 parent 56f017f commit e543305
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
18 changes: 18 additions & 0 deletions 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;
}
}
4 changes: 4 additions & 0 deletions deck.ignite.html
@@ -0,0 +1,4 @@
<!-- deck.ignite snippet -->
<p class="deck-ignite">
<span class="deck-ignite-countdown"></span>
</p>
35 changes: 29 additions & 6 deletions 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
Expand All @@ -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);
}

Expand All @@ -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);
}
}
Expand All @@ -68,4 +92,3 @@ Runs a slide deck in ignite mode
}
});
})(jQuery, 'deck');

0 comments on commit e543305

Please sign in to comment.