1


UI datepicker をカレンダーとして選択し、手がかりヒントを使用てイベントを表示しました。月を変更するまで、スクリプトは機能しています (ボタン <- または -> を押します)。
主なアイデアは、タイトルを日付を保持する要素に設定し、ホバー表示でヒントを使用してテキストを行に分割することでした。

編集:これが例です-私の問題を理解するのに役立つことを願っています。

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>

前もって感謝します!

4

1 に答える 1

1

UberNeet の投稿に感謝します: jQuery ほろ酔いの jQuery UI Datepicker

答えを見つけました。

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

これが誰かを助けることを願っています。

于 2010-11-08T00:12:08.533 に答える