我正在使用此日历创建活动日历。我每个月都有一些常规活动,例如会议、派对、提交、研讨会。我的想法是如何根据活动名称更改日期的背景图像以及如何添加消息剩余日期不是动态事件。这是我的代码:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<link rel="stylesheet" href="jw-jqm-cal.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" src="jw-jqm-cal.js"></script>
<script type="text/javascript">
$(document).on('pageinit', "#view-calendar", function(event, ui) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$("#calendar").jqmCalendar({
events: [{
"summary": "Birthday Dinnaer",
"begin": new Date(y, m, d + 10),
"end": new Date(y, m, d + 11)
}, {
"summary": "Meeting With Project Manager at Diamond Hall",
"begin": new Date(y, m, d + 3),
"end": new Date(y, m, d + 4)
},
],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
days: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
startOfWeek: 0
});
$("#calendar").bind('change', function(event, date) {
console.log(date);
//$("#message").empty();
///$("#message").append('<p><strong>There is No event at'+date+'</strong></p>');
});
})
</script>
</head>
<body>
<div data-role="page" id="view-calendar">
<div data-role="header">
<h1>Tradition Calendar</h1>
</div>
<div data-role="content">
<div id="calendar"></div>
<div id="message"></div>
</div>
</div>
</body>
</html>