Question

I am making a calendar for March, which includes each day is a block (div) that contains that day offer, but when the day has passed, it must change the image to another one, but must remain visible.

How can I do this? I have found to show specific day, week etc, but to do exactly that I am baffled..

Thanks

Was it helpful?

Solution

I used this code:

$('#calendar img').each(function () {
  if (new Date($(this).data('date')).getTime() < new Date().getTime()-24*60*60*1000) {
    $(this).css({
      opacity: 0.5,
      border: '2px solid red'
    });
  }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top