javascript jQuery FullCalendar 不呈现
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10340362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery FullCalendar not rendering
提问by ksumarine
I have a working fullcalendar on my site, however, the actual calendar table doesn't show until you change the month/year or select "today".
我的网站上有一个完整的日历,但是,在您更改月/年或选择“今天”之前,不会显示实际的日历表。
If I look at the rendered source, I see that the div around the table is empty until I press a button.
如果我查看渲染源,我会看到桌子周围的 div 是空的,直到我按下按钮。
<div style="position: absolute; -moz-user-select: none;" class="fc-view fc-view-month fc-grid" unselectable="on"></div>
Does anyone have a clue why this is happening?
有谁知道为什么会这样?
回答by ganeshk
Do you have this calendar in a tab or a dialog, which is hidden from view at first?
您在选项卡或对话框中是否有此日历,最初是隐藏在视图中的?
If so, you need to explicitly render the fullCalendar when that control is active.
如果是这样,您需要在该控件处于活动状态时显式呈现 fullCalendar。
Let's say you are using the jQuery UI Tabs widget and have the FullCalendar in the 2nd tab (which is hidden from view till the 2nd tab is selected). In this case, you could do something like this:
假设您正在使用 jQuery UI 选项卡小部件,并且在第二个选项卡中有 FullCalendar(在选择第二个选项卡之前从视图中隐藏)。在这种情况下,您可以执行以下操作:
$('#tabs').tabs({
show: function(event, ui) {
$('#calendar').fullCalendar('render');
}
});
This makes sure that the calendar is rendered when the tab is shown. Hope this helps!
这可确保在显示选项卡时呈现日历。希望这可以帮助!