我正在研究jQuery 完整日历及其在 windows/Linux 上的显示事件,如果我在 iPad(safari 浏览器)上进行测试,日历不会显示事件。如果我点击任何日期,事件点击功能正常工作但根本不显示事件。
这是我的代码:
var SITE_URL = 'MY_SITE_URL';
$(document).ready(function () {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek'
},
editable: true,
draggable: true,
dayClick: function (date, allDay, jsEvent, view) {
var myDate = new Date();
if (date.getDate() < myDate.getDate()) {
//TRUE Clicked date smaller than today
alert("You cannot book on this day!");
} else {
//dynamically load soloads which are not assigned to any date
var mmon = parseInt(date.getMonth() + 1);
var clicked_date = date.getDate() + '_' + mmon + '_' + date.getFullYear();
$('#get_selected_date').val(clicked_date);
$.ajax({
url: SITE_URL + 'member/getUserUnassignedAds',
type: 'POST',
success: function (data) {
$('#soloadsdropdown').html(data);
$('#addsoloadformlink').trigger('click');
}
});
}
},
events: function (start, end, callback) {
// on calendar loads this ajax runs
$.ajax({
url: SITE_URL + 'member/getUserAllAssignedAds',
success: function (doc) {
var doc = $.parseJSON(doc);
var events = [];
$(doc).each(function (i, val) {
events.push({
id: doc[i].id,
title: doc[i].title,
start: new Date(doc[i].start),
color: doc[i].color
});
});
callback(events);
}
});
},
eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc) {
var dataString = 'assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/checkIfAdIsOrdered',
type: 'POST',
data: dataString,
success: function (data) {
if (data != '0') {
if (data == 'mybought') {
alert("You cannot schedule bought ads!");
} else {
alert("You cannot rearrange sold ads!");
}
revertFunc();
} else {
if (!confirm("Do you really want to reschedule " + event.title + "?")) {
revertFunc();
} else {
var dataString = 'move_days=' + dayDelta + '&assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/updateUserActiveAssignedAds',
type: 'POST',
data: dataString,
success: function (data) {
if (data == 'pastdate') {
alert("You cannot edit past date events!");
revertFunc();
} else if (data == 'notdone') {
alert("You cannot book on this day!");
revertFunc();
}
}
});
}
}
}
});
},
eventClick: function (event) {
var dataString = 'assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/checkIfAdIsOrdered',
type: 'POST',
data: dataString,
success: function (data) {
if (data == 'pastdate') {
alert("You cannot edit past date events!");
} else if (data == 'reservedad') {
$('#clickreservebox').trigger('click');
$('#reservebox').show();
$('#unreservethisad').attr('rel', event.id);
} else {
if (data != '0' || data == 'mybought') {
$('#myOrderModal').html(data);
$('#clickorderconfirmbox').trigger('click');
$('#redirectbox').show();
} else {
$('#clickconfirmbox').trigger('click');
$('#confirmbox').show();
$('.pp-reserve-btn').attr('rel', event.id);
$('.pp-close-ii').attr('rel', event.id);
}
}
}
});
}
});
});
//At the end to make it real time i have added
$(document).ready(function(){
setInterval(function(){
$('#calendar').fullCalendar('refetchEvents');
}, 1000);
});