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') - 这样你就不需要编辑插件了。现在,关闭对话框并重新打开后,只显示一个日历。

更多相关文章

  1. jQuery使用微调器加载整个HTML页面
  2. 基于jQuery实现页面搜索功能----项目实战
  3. js jquery 关闭弹出页面 并刷新父页面(window.opener)
  4. jquery 触发a标签点击事件,弹出页面
  5. 如何在jQuery Datatables分页中返回特定页面?
  6. jQuery File Upload 单页面多实例的实现
  7. 如何使用CSS将表放在页面的中心?
  8. 如何在HTML中为移动页面创建图像下载链接?
  9. html 页面内锚点定位及跳转方法总结

随机推荐

  1. 干货!python与MySQL数据库的交互实战
  2. 用python数据分析了北京积分落户名单,发现
  3. Python22个构造函数法-助力数据挖掘与分
  4. 怎样开发可重用组件并发布到NPM [每日前
  5. Node.js多线程完全指南[每日前端夜话0x43
  6. 7 个Web开发工程师面试题和回答策略 [每
  7. 正则表达式在 ES2018 中的新写法 [每日前
  8. 如何用自己喜欢的 CSS 风格重置网站的样
  9. 如何用原生 DOM API 生成表格 [每日前端
  10. 2019最烂密码榜单出炉,教你设置神级密码!