css3clock.js 858 B

123456789101112131415161718192021222324252627282930313233
  1. $(function () {
  2. setInterval(function () {
  3. var seconds = new Date().getSeconds();
  4. var sdegree = seconds * 6;
  5. var srotate = "rotate(" + sdegree + "deg)";
  6. $("#sec").css({"-moz-transform": srotate, "-webkit-transform": srotate});
  7. }, 1000);
  8. setInterval(function () {
  9. var hours = new Date().getHours();
  10. var mins = new Date().getMinutes();
  11. var hdegree = hours * 30 + (mins / 2);
  12. var hrotate = "rotate(" + hdegree + "deg)";
  13. $("#hour").css({"-moz-transform": hrotate, "-webkit-transform": hrotate});
  14. }, 1000);
  15. setInterval(function () {
  16. var mins = new Date().getMinutes();
  17. var mdegree = mins * 6;
  18. var mrotate = "rotate(" + mdegree + "deg)";
  19. $("#min").css({"-moz-transform": mrotate, "-webkit-transform": mrotate});
  20. }, 1000);
  21. });