Javascript Cluetip不';每月更换uidatepicker后无法工作

Javascript Cluetip不';每月更换uidatepicker后无法工作,javascript,jquery,calendar,uidatepicker,cluetip,Javascript,Jquery,Calendar,Uidatepicker,Cluetip,选择ui日期选择器作为日历,并使用cluetip显示事件。脚本一直在工作,直到我更改月份(按钮)。 其主要思想是为保存日期和悬停显示的元素设置标题&使用cluetip将文本拆分成行 编辑:这里是-希望这将有助于了解我的问题 以下是javascript代码: $(document).ready(function() { var dates =[ // adding events [new Date(2010,8,01),new Date(2010,8,03),"Event1 | text | ne


选择ui日期选择器作为日历,并使用cluetip显示事件。脚本一直在工作,直到我更改月份(按钮)。
其主要思想是为保存日期和悬停显示的元素设置标题&使用cluetip将文本拆分成行

编辑:这里是-希望这将有助于了解我的问题

以下是javascript代码:

$(document).ready(function() {
var dates =[ // adding events
[new Date(2010,8,01),new Date(2010,8,03),"Event1 | text | next line"]
];

$('#calendar').datepicker({ 
beforeShowDay: highlightEvents,
});

function highlightEvents(date) {
for (var i = 0; i < dates.length; i++) {
if (dates[i][0] <= date && dates[i][2] >= date) {
return [true, 'odd', dates[i][2]]; } // odd == style 
}

$('td.odd').cluetip({ // cluetip main function
splitTitle: '|',
cluetipClass: 'jtip',
arrows: true, 
dropShadow: true,
});
});
$(文档).ready(函数(){
var dates=[//添加事件
[新日期(2010年8月1日),新日期(2010年8月3日),“事件1 |文本|下一行”]
];
$(“#日历”).datepicker({
展会前:Highlight活动,
});
函数highlightEvents(日期){
对于(变量i=0;i
Html代码:

<div id="calendar"></div>

提前感谢!

感谢优步网帖子:

找到了答案

// Because the the event `onChangeMonthYear` get's called before updating 
// the items, we'll add our code after the elements get rebuilt. We will hook 
// to the `_updateDatepicker` method in the `Datepicker`.
// Saves the original function.
var _updateDatepicker_o = $.datepicker._updateDatepicker;
// Replaces the function.
$.datepicker._updateDatepicker = function(inst){ 
   // First we call the original function from the appropiate context.
   _updateDatepicker_o.apply(this, [inst]); 
   // No we can update the Tipsys.
   addTipsys(inst.drawYear, inst.drawMonth+1, inst.id);
};
希望这能对某人有所帮助。

感谢优步网帖子:

找到了答案

// Because the the event `onChangeMonthYear` get's called before updating 
// the items, we'll add our code after the elements get rebuilt. We will hook 
// to the `_updateDatepicker` method in the `Datepicker`.
// Saves the original function.
var _updateDatepicker_o = $.datepicker._updateDatepicker;
// Replaces the function.
$.datepicker._updateDatepicker = function(inst){ 
   // First we call the original function from the appropiate context.
   _updateDatepicker_o.apply(this, [inst]); 
   // No we can update the Tipsys.
   addTipsys(inst.drawYear, inst.drawMonth+1, inst.id);
};
希望这能帮助别人