>我正在尝试在我的 django 应用程序中导入 fullCalendar
它不起作用。我收到错误为:
未捕获的类型错误:对象 [对象对象] 没有方法"fullCalendar"(索引):38
(匿名功能) (索引):38
c jquery.js:3048
p.firewith jquery.js:3160
x.extend.ready jquery.js:433
问
我也使用了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>
尝试在 id 为 "calendar" 的div 之后运行代码