horo

In this example below you will see how to do a horo with some HTML / CSS and Javascript

CSS and JS clock template. Material Design (Lite) style Code is on GitHub as well: https://github.com/milchkannen/horo

Thumbnail
This awesome code was written by kilchenmann, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright kilchenmann ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>horo</title>
  
  
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,700'>
<link rel='stylesheet prefetch' href='https://code.getmdl.io/1.1.3/material.light_blue-blue.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="clock">
  <span class="hours"></span>
  <span class="minutes"></span>
  <span class="seconds"></span>
</div>

<footer><p><a href="https://codepen.io/milchkannen/full/yYMoLw/">hOrO</a> by <a href="http://milchkannen.ch">milchkannen</a> | Background image from <a href="http://unsplash.com">Unsplash</a> (random mode) | Made with <img src="http://milchkannen.ch/assets/images/made-with-coffe.png?v=0970447d37" alt="coffee" title="coffee" class="icon" /></p></footer>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://storage.googleapis.com/code.getmdl.io/1.1.3/material.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/kilchenmann/horo-yYMoLw */
body {
  font-family: 'Roboto';
  color: #eeeeee;
  background: url("https://source.unsplash.com/all/?night") no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

.clock {
  color: #eeeeee;
  margin-top: 70px;
  margin-left: 113px;
  position: relative;
}
.clock .hours,
.clock .minutes,
.clock .seconds {
  border-radius: 50%;
  text-align: center;
  position: absolute;
}
.clock .seconds {
  width: 66.6666666667px;
  height: 66.6666666667px;
  top: 72.6666666667px;
  left: 72.6666666667px;
  line-height: 1.5;
  font-size: 41.203131438px;
  z-index: 1;
  background-color: rgba(222, 222, 222, 0.41);
}
.clock .minutes {
  width: 100px;
  height: 100px;
  top: 56px;
  left: 56px;
  line-height: 1.5;
  font-size: 61.804697157px;
  z-index: 2;
}
.clock .hours {
  width: 200px;
  height: 200px;
  line-height: 1.5;
  font-size: 123.609394314px;
  z-index: 0;
  border: 6px solid #f4f4f4;
}

footer {
  position: fixed;
  bottom: 0;
  text-align: center;
  width: 100vw;
  color: #9e9e9e;
}
footer a {
  text-decoration: none;
  color: #9e9e9e;
  font-weight: bolder;
}
footer p img.icon {
  width: 32px;
  height: 32px;
}


/*Downloaded from https://www.codeseek.co/kilchenmann/horo-yYMoLw */
setInterval(function() {
  var secondsSize = $('.seconds').width();
  var minutesSize = $('.minutes').width();
  var hoursSize = $('.hours').width();
  var seconds = new Date().getSeconds();
  var sdegree = seconds * 6 + 270;
  var stranslate = Math.round(hoursSize / 2 + secondsSize / 2);
  seconds = ("0" + seconds).slice(-2);
  $(".seconds").css({
    "transform": "rotate(" + sdegree + "deg) translate(" + stranslate + "px) rotate(-" + sdegree + "deg)"
  }).text(seconds);

  var minutes = new Date().getMinutes();
  var mdegree = minutes * 6 + 270;
  var mtranslate = Math.round(hoursSize / 2 + minutesSize / 2);
  minutes = ("0" + minutes).slice(-2);
  $(".minutes").css({
    "transform": "rotate(" + mdegree + "deg) translate(" + mtranslate + "px) rotate(-" + mdegree + "deg)"
  }).text(minutes);

  var hours = new Date().getHours();
  hours = ("0" + hours).slice(-2);
  $(".hours").text(hours);

}, 1000);

Comments