문제

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

도움이 되었습니까?

해결책

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'
    });
  }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top