我正在尝试在我的django app中导入fullCalendar
它不起作用。我收到一个错误:
未捕获TypeError:对象[object Object]没有方法'fullCalendar'(索引):38
(匿名函数)(索引):38
c jquery.js:3048
p.fireWith jquery.js:3160
x.extend.ready jquery.js:433
q
我使用了noConflict();也。仍然没有解决错误。
正确加载jQuery。仍然不显示日历。
这是我的档案:
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/lib/jquery.min.js'></script>
<script src='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/lib/jquery-ui.custom.min.js'></script>
<script src='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/fullcalendar/fullcalendar.min.js'></script>
<script src='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/fullcalendar/fullcalendar.js'></script>
<script src='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/fullcalendar/gcal.js'></script>
<link href='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/fullcalendar/fullcalendar.css'
rel='stylesheet' type='text/css' />
<link href='/home/ttt/ashwini_booktype/Booktype/lib/booki/templates/fullcalendar/fullcalendar.print.css'
rel='stylesheet' media='print' type='text/css' />
<script>
if (typeof jQuery !== 'undefined') {
console.log('jQuery Loaded');
}
else {
console.log('not loaded yet');
}
var j = jQuery.noConflict();
j(document).ready(function ($) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
editable: true,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d - 5),
end: new Date(y, m, d - 2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d - 3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d + 4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d + 1, 19, 0),
end: new Date(y, m, d + 1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
</script>
<style>
body
{
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande" ,Helvetica,Arial,Verdana,sans-serif;
}
#calendar
{
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div style="width: 800px height: 600px;">
<div id='calendar'>
</div>
</body>
</html>
答案 0 :(得分:1)
尝试在ID为“calendar”的div之后运行代码