【问题标题】:Fullcalendar jquery not working in wordpressFullcalendar jquery在wordpress中不起作用
【发布时间】:2016-08-06 11:43:35
【问题描述】:

我正在研究 Fullcalendar 可选 jquery。我需要在 wordpress 中使用它。我创建了一个模板文件并在模板文件中调用日历 div,并在标题中包含 css 文件“fullcalendar.css”和“fullcalendar.print.css”,在“moment.min.js”和“fullcalendar.min.js”中包含页脚。它只显示没有任何 CSS 效果的日历并且不工作可选事件。文件已正确包含,并且未显示任何 javascript 错误。我正在使用这个完整的日历脚本。我已尝试停用所有插件。

jQuery(document).ready(function($) {

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultDate: '2016-08-05',
        theme: true,
        selectable: true, 
        selectHelper: true,
        select: function(start, end) {
            var title = prompt('Event Title:'); alert(title);
            var eventData;
            if (title) {
                eventData = {
                    title: title,
                    start: start,
                    end: end
                };

                $('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
            } 

            $('#calendar').fullCalendar('unselect');
        },
        editable: true,
        eventLimit: true, // allow "more" link when too many events
        events: [
            {
                title: 'All Day Event',
                start: '2016-08-09'
            },
            {
                title: 'Long Event',
                start: '2016-08-07',
                end: '2016-08-15'
            },
            {
                id: 999,
                title: 'Repeating Event',
                start: '2016-06-09T16:00:00'
            },
            {
                id: 999,
                title: 'Repeating Event',
                start: '2016-06-16T16:00:00'
            },
            {
                title: 'Conference',
                start: '2016-06-11',
                end: '2016-06-13'
            },
            {
                title: 'Meeting',
                start: '2016-06-12T10:30:00',
                end: '2016-06-12T12:30:00'
            },
            {
                title: 'Lunch',
                start: '2016-06-12T12:00:00'
            },
            {
                title: 'Meeting',
                start: '2016-06-12T14:30:00'
            },
            {
                title: 'Happy Hour',
                start: '2016-06-12T17:30:00'
            },
            {
                title: 'Dinner',
                start: '2016-06-12T20:00:00'
            },
            {
                title: 'Birthday Party',
                start: '2016-06-13T07:00:00'
            },
            {
                title: 'Click for Google',
                url: 'http://google.com/',
                start: '2016-06-28'
            }
        ]
    });
}); 

【问题讨论】:

  • 恐怕你需要在网络上或在 jsfiddle 上设置一个演示。
  • 我已经在 localhost 上尝试过它正在工作,并且在 wordpress 主根中它正在工作,但是当我尝试在主题中的 ant 模板文件上使用它时,它就无法工作。

标签: wordpress fullcalendar


【解决方案1】:

我的问题已经解决。我在“fullcalendar.min.css”之后添加了“fullcalendar.print.css”。当我评论“print.css”文件时,它开始正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-30
    • 1970-01-01
    • 2013-06-16
    • 2014-09-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多