在zabuto日历中更改徽章的颜色

时间:2017-05-26 20:11:50

标签: jquery css calendar

我的网站上有一个zabuto日历,我在其中加载来自ajax调用的事件。该事件由日历中的黄色徽章表示。我的问题是:存在一种改变徽章颜色的方法吗?

这是我的代码:

<div id="my-calendar"></div>
    <script type="application/javascript">
        $(document).ready(function () {
            $("#my-calendar").zabuto_calendar({
                today: true,
                language: "es",
                ajax: {
                    url: "<?php echo base_url();?>index.php/client/build_date/",
                    modal: true
                }
            });
       });
   </script>

提前致谢!

2 个答案:

答案 0 :(得分:0)

您应该能够使用CSS覆盖默认颜色!重要。 看一下日历的例子,我认为这应该有效:

.event.event-clickable{   //for a clickable event
   background-color: blue !important; //your choice of color
}

.badge.badge-event{       //for the badge color
  background-color: red !important; //your choice of color
}

答案 1 :(得分:0)

这里是另一个示例:

var dateString = (new Date()).toISOString().split("T")[0];

var eventData = [{
  "date": dateString,
  "badge": true,
  "title": dateString
}, ];

// initialize the calendar on ready
$("#my-calendar").zabuto_calendar({
  legend: [{
    type: "text",
    label: "Special event",
    badge: "00"
  }],
  data: eventData,
  cell_border: true,
  show_previous: 2,
  show_next: 2,
  weekstartson: 0,
  nav_icon: {
    prev: '<i class="fa fa-chevron-circle-left"></i>',
    next: '<i class="fa fa-chevron-circle-right"></i>'
  }
});
div.zabuto_calendar .badge-event,
div.zabuto_calendar div.legend span.badge-event {
  background: linear-gradient(141deg, #0fb8ad 0%, #1fc8db 51%, #2cb5e8 75%) !important;
  color: #fff;
  text-shadow: none;
}

div.zabuto_calendar .table tr td.event div.day,
div.zabuto_calendar ul.legend li.event {
  background-color: #AEEEFF !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/zabuto_calendar/1.6.3/zabuto_calendar.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/zabuto_calendar/1.6.3/zabuto_calendar.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet" />
<div id="my-calendar"></div>