0
我想顯示具有相同事件ID的週期性事件的eventmouseover事件上的事件描述的工具提示,但我只想載入實際描述json在事件的第一次發生時提供反饋。有關具有相同ID的週期性事件的工具提示描述
想要這樣做的原因是因爲某些事件描述可能會很長,而且我不想加載完全相同的段落100次或更多,並通過網絡發送,如果我只能訪問第一個事件的描述,並在我將鼠標懸停在任何重複事件的工具提示中時顯示。
我的日曆初始化代碼:
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: false,
allDayDefault: false,
events: "https://json_feed_url",
eventMouseover: function(e,m){
var tPosX = m.pageX - 5 ;
var tPosY = m.pageY + 20 ;
$('#tooltip').css({top: tPosY, left: tPosX, display: 'block'});
var tt = '';
tt += e.id+'<br />';
$('#tooltip').html(tt);
},
eventMouseout: function(){
$('#tooltip').css({display: 'none'});
},
loading: function(bool){
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
和我的JSON數據料會像這樣:
[
{
"id": 0,
"title": "Study Hall",
"start": "2012-01-09T15:00",
"end": "2012-01-09T16:15",
"color": "green",
"description": "Discuss formal language theory and abstract machines"
},
{
"id": 0,
"title": "Study Hall",
"start": "2012-01-11T15:00",
"end": "2012-01-11T16:15",
"color": "green",
"description": ""
},
{
"id": 0,
"title": "Study Hall",
"start": "2012-01-16T15:00",
"end": "2012-01-16T16:15",
"color": "green",
"description": ""
},
{
"id": 0,
"title": "Study Hall",
"start": "2012-01-18T15:00",
"end": "2012-01-18T16:15",
"color": "green",
"description": ""
},
{
"id": 0,
"title": "Study Hall",
"start": "2012-01-23T15:00",
"end": "2012-01-23T16:15",
"color": "green",
"description": ""
},
{
"id": 0,
"title": "StudyHall",
"start": "2012-04-25T15: 00",
"end": "2012-04-25T16: 15",
"color": "green",
"description": ""
}
]
也能正常工作的情況下的非常第一次出現,但其餘的事件說明在工具提示中全部爲空。有沒有人有引用第一次出現的解決方案?
謝謝