Fullcalendar:为什么日历在页面上出现两次?
I am using Fullcalendar for jQuery and for some reason the calendar is appearing twice on the page. This is not a question about having two instances of fullcalendar on the same page.
我正在使用Fullcalendar for jQuery,由于某种原因,日历在页面上出现两次。这不是关于在同一页面上有两个fullcalendar实例的问题。
Rather, at the bottom of the first calendar, there is a second identical calendar.
相反,在第一个日历的底部,存在第二个相同的日历。
I confirmed that there is only one #calendar div in my page, so the error has something to do with my .js that calls fullcalendar.js, I believe.
我确认我的页面中只有一个#calendar div,所以错误与调用fullcalendar.js的.js有关,我相信。
Any help much appreciated.
任何帮助非常感谢。
JS Code:
jQuery('#calendar').fullCalendar({
year: jQuery.today.getFullYear(),
month: jQuery.today.getMonth(),
date: jQuery.today.getDate(),
theme: true,
contentHeight: 1000,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaDay',
dayClick: function(date, allDay, jsEvent, view) {
// a lot of custom code
}
});
HTML:
<table><tr><td valign="top" width="700px"><div id="calendar"></div></td></tr></table>
Other call of fullcalendar in javascript (this puts a datepicker in div to left of #calendar div on same page):
javascript中对fullcalendar的其他调用(这会将一个datepicker放在同一页面上#calendar div左边的div中):
jQuery('#datepicker_for_calendar').datepicker({
defaultDate: jQuery.today,
minDate: jQuery.startDate,
maxDate: jQuery.endDate,
inline: true,
showButtonPanel: true,
onSelect: function(dateText, inst) {
var d = new Date(dateText);
jQuery('#calendar').fullCalendar('gotoDate', d);
selectedDate = d;
}
});
4 个解决方案
#1
3
Add a.html('');
to function f()
in the minified version.
I had mine open up in a dialog, every time I clicked a button to open there would be another calendar.
After a bit of reading, I found the method to use - .fullCalendar('destroy')
- that way you do not need to edit the plugin.
Now, upon closing the dialog and re-opening, only one calendar appears.
添加a.html('');在缩小版本中运行f()。我在一个对话框中打开了我,每次点击一个按钮打开就会有另一个日历。经过一些阅读后,我找到了使用的方法 - .fullCalendar('destroy') - 这样你就不需要编辑插件了。现在,关闭对话框并重新打开后,只显示一个日历。
更多相关文章
- jQuery使用微调器加载整个HTML页面
- 基于jQuery实现页面搜索功能----项目实战
- js jquery 关闭弹出页面 并刷新父页面(window.opener)
- jquery 触发a标签点击事件,弹出页面
- 如何在jQuery Datatables分页中返回特定页面?
- jQuery File Upload 单页面多实例的实现
- 如何使用CSS将表放在页面的中心?
- 如何在HTML中为移动页面创建图像下载链接?
- html 页面内锚点定位及跳转方法总结