javascript - fullcalendar.js from CDNJS not working? - Stack Overflow

I had another question about this but the text was cumbersome. I deleted the other question in favor of

I had another question about this but the text was cumbersome. I deleted the other question in favor of this...

I recently found fullcalendar.js. I was initially able to see the calendar widget and the css styling, title, nav buttons, etc. But that has since stopped. I can see the widget and usually the title but not the styling or buttons.

I have a fiddle / that demonstrates this. It is using the fullcalendar libs from CDNJS. It is getting the jquery and moment.js libs from CDNJS. The fullcalendar "Support" section suggests using JSBIN... I have the same result there as with jsfiddle.

I have also tried downloading the fullcalendar library and using the included jquery and moment libs as well as using other local and CDN jquery and moment libs. It is as though fullcalendar can not find its own css.

I have run developer tools on the fiddle and on my local tests. Everything looks like it is loading.

I must be doing something trivial but I can not see it. ideas?

The libs used in the fiddle are:

  <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare/ajax/libs/fullcalendar/2.6.1/fullcalendar.min.css">
  <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare/ajax/libs/fullcalendar/2.6.1/fullcalendar.print.css">

  <script type="text/javascript" src="//cdnjs.cloudflare/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare/ajax/libs/moment.js/2.12.0/moment.min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare/ajax/libs/fullcalendar/2.6.1/fullcalendar.min.js"></script>

The html body is just

<div id='calendar'></div>

The javascript section is:

$(document).ready(function() {
  $('#calendar').fullCalendar({
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  });
});

I had another question about this but the text was cumbersome. I deleted the other question in favor of this...

I recently found fullcalendar.js. I was initially able to see the calendar widget and the css styling, title, nav buttons, etc. But that has since stopped. I can see the widget and usually the title but not the styling or buttons.

I have a fiddle https://jsfiddle/a3q9c5tr/ that demonstrates this. It is using the fullcalendar libs from CDNJS. It is getting the jquery and moment.js libs from CDNJS. The fullcalendar "Support" section suggests using JSBIN... I have the same result there as with jsfiddle.

I have also tried downloading the fullcalendar library and using the included jquery and moment libs as well as using other local and CDN jquery and moment libs. It is as though fullcalendar can not find its own css.

I have run developer tools on the fiddle and on my local tests. Everything looks like it is loading.

I must be doing something trivial but I can not see it. ideas?

The libs used in the fiddle are:

  <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare./ajax/libs/fullcalendar/2.6.1/fullcalendar.min.css">
  <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare./ajax/libs/fullcalendar/2.6.1/fullcalendar.print.css">

  <script type="text/javascript" src="//cdnjs.cloudflare./ajax/libs/jquery/2.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare./ajax/libs/moment.js/2.12.0/moment.min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare./ajax/libs/fullcalendar/2.6.1/fullcalendar.min.js"></script>

The html body is just

<div id='calendar'></div>

The javascript section is:

$(document).ready(function() {
  $('#calendar').fullCalendar({
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  });
});
Share Improve this question asked Mar 15, 2016 at 16:19 7 Reeds7 Reeds 2,5794 gold badges39 silver badges70 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

UPDATE:

I fixed the fiddle and it is using the newest release of fullcalendar: https://jsfiddle/y3llowjack3t/a3q9c5tr/4/

Just remove the fullcalendar.print.css

$(document).ready(function() {

  $('#calendar1').fullCalendar({
    header: {
      left: 'prev,next,today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
      }
  });

});

And to see the calendar with a theme do

theme: true,

https://jsfiddle/y3llowjack3t/a3q9c5tr/5/

I find the solution at https://codepen.io/munr/pen/KOpyXE

// Html

<script src="https://cdn.jsdelivr/npm/@fullcalendar/[email protected]/main.min.js"></script>
<script src="https://cdn.jsdelivr/npm/@fullcalendar/[email protected]/main.js"></script>
<script src="https://cdn.jsdelivr/npm/@fullcalendar/[email protected]/main.js"></script>
<link href="https://cdn.jsdelivr/npm/@fullcalendar/[email protected]/main.min.css" rel="stylesheet"/>

<div id="calendar"></div>

//Java Script

var eventsArray = [
    {
      title  : 'event1',
      start  : '2019-07-20'
    },
    {
      title  : 'event2',
      start  : '2019-08-05',
      end    : '2019-08-07'
    },
    {
      title  : 'event3',
      start  : '2019-09-03'
    },
    {
      title  : 'event3',
      start  : '2022-10-05'
    }
  ];

document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
        height: 600,
        plugins: [ 'dayGrid', 'interaction' ],
        
        dateClick: function(info) {
            alert('Clicked on: ' + info.dateStr);
          
          eventsArray.push({
            date: info.dateStr,
            title: "test event added from click"
          });
          
          calendar.refetchEvents();
        },
      
        eventClick: function(info) {
          alert(info.event.title)
        },
      
        events: function(info, successCallback, failureCallback) {
          successCallback(eventsArray);
        }
    });

    calendar.render();
  });

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745622024a4636576.html

相关推荐

  • javascript - fullcalendar.js from CDNJS not working? - Stack Overflow

    I had another question about this but the text was cumbersome. I deleted the other question in favor of

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信