2011-04-13 56 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

相关问题