gpt4 book ai didi

javascript - 如何在日历 View 和自定义标题中标记 "current time"

转载 作者:行者123 更新时间:2023-11-30 06:04:56 25 4
gpt4 key购买 nike

我对 FullCalendar 的灵 active 感到惊讶到目前为止,但以下两个元素让我卡住了;

  1. 有没有什么方法可以在列出小时的日 View 中以粗体显示当前时间,而无需过多修改?

  2. 有什么方法可以更改日历元素的标题吗,到目前为止,它只需要用月份名称或类似名称替换的占位符“变量”,但我希望能够指定我自己的标题对他们来说(这很容易通过将它添加到元素上方来完成,但如果可以将它添加到元素中,那为什么不呢,对吧?)

最佳答案

对于 #1 Agenda DAY View ,我看到了这段代码

<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>

所以我们需要看看TH:

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>

创建日历后随心所欲

关于javascript - 如何在日历 View 和自定义标题中标记 "current time",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5650394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com