deez

Main.js

Jul 23rd, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(function($){
  2.  
  3.     var launch = new Date(2012,7,23,16,20,0);
  4.     var days = $('#days');
  5.     var hours = $('#hours');
  6.     var minutes = $('#minutes');
  7.     var seconds = $('#seconds');
  8.    
  9.     setDate();
  10.     function setDate(){
  11.         var now = new Date();
  12.         var s = ((launch.getTime() - now.getTime())/1000) - now.getTimezoneOffset()*60;
  13.         var d = Math.floor(s/86400);
  14.         days.html('<strong>'+d+'</strong>Jour'+(d>1?'s':''));
  15.         s -= d*86400;
  16.        
  17.         var h = Math.floor(s/3600);
  18.         hours.html('<strong>'+h+'</strong>Heure'+(h>1?'s':''));
  19.         s -= h*3600;
  20.        
  21.         var m = Math.floor(s/60);
  22.         minutes.html('<strong>'+m+'</strong>Minute'+(m>1?'s':''));
  23.         s -= m*60;
  24.        
  25.         s = Math.floor(s);
  26.         seconds.html('<strong>'+s+'</strong>Seconde'+(s>1?'s':''));
  27.        
  28.         setTimeout(setDate,1000);
  29.     }
  30. });
Advertisement
Add Comment
Please, Sign In to add comment