突出显示w3c小部件响应日历上的当前日期

时间:2014-07-05 06:39:04

标签: javascript jquery calendar

我正在设计一个带日历的网站来显示活动,我发现w3widgets很有用,但我在突出显示日历上的日期时遇到问题,因为它只突出显示日期事件

 <script>
       //I added this script to get me current date
        var d = new Date();
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1; //Months are zero based
        var curr_year = d.getFullYear();
        var today = curr_year+ "-" + curr_month + "-" + curr_date;


 $( document ).ready( function() {
 $(".responsive-calendar").responsiveCalendar({
 time: today, //passing var today here works
 events: {
  "2013-04-30": {"number": 5, "badgeClass": "badge-warning", "url":    "http://w3widgets.com/responsive-calendar"},
  "2013-04-26": {"number": 1, "badgeClass": "badge-warning", "url": "http://w3widgets.com"},
  today: {"class": "active special"}, //This is what highlights a date and passing today as var is not working except a date like "2014-07-05"
  "2013-05-03": {"number": 1, "badgeClass": "badge-error"}, 
  "2013-06-12": {}}
});
});
</script>

如果我今天发出警报,它会显示当前日期,但没有领先的&#34; 0&#34;然后我尝试创建一个变量var =&#34; 2014-07-05&#34;并把它传递给那个班级但它仍然没有工作。

1 个答案:

答案 0 :(得分:5)

面对同样的问题。如果您使用的是标准类名,请尝试:

.responsive-calendar .day.today a {
    background: red;
    color: #ffffff;
}