The countdown jQuery plugin by musings.it
Please note: at least one parameter between duration and endDate is mandatory and you can use up to two out of duration, endDate and startDate at the same time. You can check how to use every mcountdown parameter by clicking beside each of them.
2014.11.05 new Christmas responsive layout
2014.06.24 v.1.0 initial release
<!-- one of mcountdown styles -->
<link rel="stylesheet" href="path_to_css/mcountdown_classic_style.css" type="text/css" media="screen">
<!-- last jQuery version available -->
<script type="text/javascript" src="path_to_js/jquery-last.min.js"></script>
<!-- mcountdown jQuery plugin -->
<script type="text/javascript" src="path_to_js/jquery.mcountdown-1.0.min.js"></script>
<!-- for styling purposes I used a wrapper for the counter <div> (if you use it remember to add a .mcountdown-wrapper class for it) -->
<div class="mcountdown-wrapper">
<!-- this is the only mandatory <div>, it must have .mcountdown-counter class -->
<div id="counter" class="mcountdown-counter"></div>
<!-- if the countdown should start manually, you will need a <div> for control buttons and it must have .mcountdown-controls class -->
<div class="mcountdown-controls">
<!-- note: control buttons must have these classes -->
<span class="mcountdown-start">start</span>
<span class="mcountdown-stop">stop</span>
<span class="mcountdown-reset">reset</span>
</div>
</div>
/* you can style your counter as you wish, this is how I did it for this demo */
/* counter wrapper */
.mcountdown-wrapper {
position: relative;
margin: 0 auto;
width: 100%;
max-width: 1140px;
text-align: center;
}
/* counter */
#counter {
position: relative;
margin: 0 auto 1em auto;
width: 100%;
border: 3px solid #ff00ff;
border-radius: 0.5em;
padding: 0.5em 0.3em;
background: #f0f0f0;
background: rgba(255,255,255,0.85);
}
#counter h1 {
font-size: 2.5em;
font-weight: 700;
margin-bottom: 0.3em;
}
#counter p {
font-size: 1.25em;
line-height: 120%;
}
#counter p.mcountdown-paragraph {
font-size: 2.5em;
}
.mcountdown-counter .mcountdown-paragraph > div,
.mcountdown-counter .mcountdown-paragraph-elapsed > div {
display: inline;
}
/* control buttons */
.mcountdown-controls {
position: relative;
margin: 2em auto;
text-align: center;
}
.mcountdown-controls span {
border: 2px solid #ff00ff;
border-radius: 0.5em;
padding: 0.5em 1em;
margin: 0.5em;
background: #f0f0f0;
background: rgba(255,255,255,0.85);
cursor: pointer;
}
.mcountdown-controls span:hover {
background: #fafafa;
}
.mcountdown-controls span.disabled {
cursor: auto;
}
.mcountdown-controls span.disabled:hover {
background: #f0f0f0;
}
$(document).ready(function() {
$("#counter").mcountdown({
duration: "00:00:00:20", // countdown duration
autoStart: true, // automatic start
cycle: true, // reset all parameters after countdown is complete
countdownUnitsToShow: ["days","hours","minutes","seconds"], // show days, hours, minutes and seconds in the countdown
countdownUnitsLabels: [" days "," hours "," minutes "," seconds"], // these are the labels to be shown after the digits
showElapsedTime: true, // show time elapsed from countdown start
elapsedTimeLabel: "Elapsed time: ", // this is the label to be shown before elapsed time digits
onComplete: changeMyColors // this is my custom function to be called after countdown is complete
});
});