Special Effect Calendar Script

Bring your site to life with an animated date selector. This script scans through the months and days with a visual highlight effect, eventually locking onto the current local date.

Animated Highlight Demo

Get the Code

<style>
  .active { background: blue; color: white; }
  .month, .day { padding: 5px; display: inline-block; }
</style>

<div id="calendar"></div>

<script>
var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var now = new Date();
var targetMonth = now.getMonth();
var targetDay = now.getDate();

function scanCalendar(idx) {
  // Logic to iterate through elements and apply the .active class
  // until idx matches targetMonth/targetDay
}
</script>

FAQ

Yes. Within the JavaScript function, you can adjust the setTimeout value (in milliseconds) to make the scanning effect faster or slower.

The script pulls the day and month from the user's system clock, so it will always highlight the correct current date, including February 29th.