【问题标题】:Cluetip doesn't work after changing uidatepicker month更改 uidatepicker 月份后,提示提示不起作用
【发布时间】:2010-11-08 08:12:08
【问题描述】:


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

编辑:这是example - 希望它有助于理解我的问题。

这里是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,
});
});

HTML代码:

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

提前致谢!

【问题讨论】:

    标签: javascript jquery calendar uidatepicker cluetip


    【解决方案1】:

    感谢 UberNeet 帖子: jQuery UI Datepicker with jQuery tipsy

    找到答案了。

    // 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);
    };
    

    希望这会对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多