jQuery Sexy Clock


/ Published in: jQuery
Save to your folder(s)

(I am not the author of this script. I suppose the homepage of the author is the following: [http://iyoremo.com/](http://iyoremo.com/))


Copy this code and paste it in your HTML
  1. $(function(){
  2.  
  3. var speed = 1000;
  4. var speedup = 200;
  5. var pos = [];
  6. var pos_count = 6;
  7.  
  8. $('#preload img').ready(function(){
  9. $('#wait').hide();
  10. (function(){
  11. var tm = new Date();
  12. setto(tm.getHours()*10000+tm.getMinutes()*100+tm.getSeconds());
  13. setTimeout(arguments.callee,speed);
  14. })()
  15. });
  16.  
  17. function setto(to){
  18. for ( var j=0; j<pos_count; j++){
  19. var postmp = (j) ? Math.floor(to/Math.pow(10,j))%10 : to%10;
  20. if ( pos[j] != postmp ){
  21. pos[j] = postmp;
  22. plus(pos[j],j+1);
  23. }
  24. }
  25. }
  26.  
  27. function plus (to,pos){
  28. var pos_dn = $('.dn .p'+pos);
  29. var i_to = $('<img>');
  30. i_to.attr('src','images/dn'+to+'.png');
  31. var i_from = $('img',pos_dn);
  32. i_from.attr('width',120);
  33. pos_dn.prepend(i_to);
  34. i_from.animate({height:10},speedup,function(){
  35. var pos_dn = $('.dn .p'+pos);
  36. $('img',pos_dn).eq(1).remove();
  37.  
  38. var pos_up = $('.up .p'+pos);
  39. var i_to = $('<img>');
  40. i_to.attr('src','images/up'+to+'.png');
  41. i_to.attr('width',120);
  42. i_to.attr('height',10);
  43. var i_from = $('img',pos_up);
  44. pos_up.append(i_to);
  45. i_to.animate({height:100},speedup, function(){
  46. var pos_up = $('.up .p'+pos);
  47. $('img',pos_up).eq(0).remove();
  48. })
  49. });
  50. }
  51.  
  52. })

URL: http://iyoremo.com/jquery-sexy-clock/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.