/ Published in: JavaScript
Set the desired date within the function. Make some images and label them "1.jpg, 2.jpg, 3.jpg, etc...". That's how it's done.
Expand |
Embed | Plain Text
<style type="text/css"> .countDown { font-family:"Helvetica Neue",Helvetica,Calibri,"Liberation Sans",Arial,sans-serif; font-weight:300; letter-spacing:0.5px; text-align:center; } </style> <script type="text/javascript"> currentDate = new Date(); zeroDay = new Date("January 1, 2013"); // <===|INSERT_DATE_HERE msPerDay = 864E5; time = (zeroDay.getTime() - currentDate.getTime()); days= time / msPerDay; dayCount = Math.floor(days); image = parseInt(dayCount) + 2; countDown ="<div id='countDown' class='countDown'>It's coming. Are you ready?<br>"+dayCount+" days until "+zeroDay+".</div>"; if (dayCount > 30){document.write(countDown);} else if (dayCount <= 30){document.write("<img id='countDown' class='countDown' src='"+image+".jpg' alt='It's coming.'/>");} else {document.write("<img id='countDown' class='countDown' src='1.jpg' alt=''It's coming.'/>");} </script>
You need to login to post a comment.
