2011-04-13 59 views
2

到目前爲止,我一直對FullCalendar的靈活性感到驚訝,但以下兩個元素讓我卡住了;如何在日曆視圖和自定義標題中標記「當前時間」

  1. 有沒有什麼辦法,使在日視圖,它裏面列出小時加粗顯示當前時間,沒有太多的兩輪牛車?

  2. 是否有任何方法來更改日曆元素的標題,到目前爲止它只佔用佔位符「變量」,用月份名稱或類似名稱替換,但我希望能夠指定我自己的標題他們(這是很容易把它加在元件上完成的,但如果是可以將其內,那麼,爲什麼不加吧?)

+0

對於#1,僅在今天查看時間的粗體顯示時間,還是粗體顯示,無論哪一天?你的意思是「基本日」視圖,「議程日」視圖還是兩者? – 2011-04-13 13:56:02

回答

1

#1議程一天視圖我看到這個代碼

<tr class="fc-slot22 "> 
    <th class="fc-agenda-axis fc-widget-header">11am</th> 
    <td class="fc-widget-content"><div style="position:relative">&nbsp;</div></td> 
</tr> 
<tr class="fc-slot23 fc-minor"> 
    <th class="fc-agenda-axis fc-widget-header">&nbsp;</th> 
    <td class="fc-widget-content"><div style="position:relative">&nbsp;</div></td> 
</tr> 
<tr class="fc-slot24 "> 
    <th class="fc-agenda-axis fc-widget-header">12pm</th> 
    <td class="fc-widget-content"><div style="position:relative">&nbsp;</div></td> 
</tr> 

所以我們需要看看THs:

var nowHours = new Date().getHours(); 
var hourAMPM = (nowHours>12)?(nowHours-12)+"pm":nowHours+"am"; 
if (nowHours===12) hourAMPM ="12pm"; 
$("th").removeClass("nowtime"); 
$("th").contains(hourAMPM).addClass("nowtime"); 

#1至大膽日曆當天變化

.fc-state-highlight { 
    background: none repeat scroll 0 0 #FFFFCC; 
} 

.fc-state-highlight { 
    background: none repeat scroll 0 0 #FFFFCC; 
    font-weight: bold; 
} 

#2你可以改變

<span class="fc-header-title"> 
<h2>April‌·2011</h2> 
</span> 

到任何你想要的後創建日曆

+0

事實上,我認爲這將是實現目標的方式,我只是希望有一些改變它們的功能,我目前還沒有意識到,謝謝您的反饋! – Clorith 2011-04-14 05:53:41

+0

@Strifariz也許作者會很高興看到這個? – mplungjan 2011-04-14 06:06:35

相關問題