jQuery 关于实施的完整日历问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21367623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Full Calendar issue on implementing
提问by Damiii
I'm having an issue with implementing FullCalendar... And i think, i did all the things said on "Basic Usage" topic at http://arshaw.com/fullcalendar/docs/usage/Why that piece of code doesn't appear my callendar on my .html ?
我在实施 FullCalendar 时遇到了问题......而且我想,我做了所有关于“基本用法”主题在http://arshaw.com/fullcalendar/docs/usage/为什么那段代码没有的事情在我的 .html 上出现我的 callendar 吗?
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Callendar Test
</title>
<link rel='stylesheet' type='text/css' href='fullcalendar.css' />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src='fullcalendar.js'></script>
<script type="text/javascript">
$(document).ready(function() {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
})
});
</script>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
Any solution ?
任何解决方案?
P.S.: I downloaded the Jquery file (version 1.x) and put on the same file as my HTML page.
PS:我下载了 Jquery 文件(版本 1.x)并放在与我的 HTML 页面相同的文件中。
Errors:
错误:
Unknown property 'zoom'. Declaration dropped. fullcalendar.css:107
18:50:38.058 Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. fullcalendar.css:133
18:50:38.058 Error in parsing value for 'background-image'. Declaration dropped. fullcalendar.css:213
18:50:38.058 Error in parsing value for 'background-image'. Declaration dropped. fullcalendar.css:214
18:50:38.058 Error in parsing value for 'background-image'. Declaration dropped. fullcalendar.css:215
18:50:38.058 Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. fullcalendar.css:255
18:50:38.058 Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. fullcalendar.css:414
18:50:38.059 Expected declaration but found '*'. Skipped to next declaration. fullcalendar.css:532
18:50:38.059 Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. fullcalendar.css:575
18:50:38.059 Error in parsing value for 'display'. Declaration dropped. fullcalendar.css:580
18:50:38.092 ReferenceError: moment is not defined fullcalendar.js:12
18:50:38.094 The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. FullCalendar.html
18:50:38.116 TypeError: $(...).fullCalendar is not a function
Here it is my directory :
这是我的目录:
采纳答案by Nicholas Hazel
18:50:38.092 ReferenceError: moment is not defined fullcalendar.js:12
18:50:38.092 ReferenceError: moment is not defined fullcalendar.js:12
18:50:38.116 TypeError: $(...).fullCalendaris not a function.
18:50:38.116 类型错误:$(...).fullCalendar不是函数。
In your calendar.js
, it would appear that you don't have a function that has an event handler
that can target a specific id
with jQuery.
在您的 中calendar.js
,您似乎没有event handler
可以specific id
使用 jQuery定位 a的函数。
Edit:
编辑:
Not sure what you're doing wrong, but I have everything working just fine, just as you have it set up.
不确定你做错了什么,但我一切正常,就像你设置的那样。
As you can see, this is ALL of my code:
如您所见,这是我的全部代码:
<!DOCTYPE html>
<html>
<head>
<link href='fullcalendar.css' rel='stylesheet' />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src='fullcalendar.min.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
});
});
</script>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
Here is my entiredirectory:
这是我的整个目录:
Here is a full repository of the files that are working just fine.
这是运行良好的文件的完整存储库。
回答by user903345
Just in case someone else finds this thread through Google and is having this same problem: If you are using the hostedlibraries for FullCalendar, you must include moment.js (not available on the hosted libraries, it seems, so you have to download it) beforeyou include the fullcalendar.js file. For example:
万一别人发现这个线程通过谷歌,并有同样的问题:如果您使用的是托管的FullCalendar库时,必须包括moment.js(上托管库无法使用,现在看来,所以你必须下载)在包含 fullcalendar.js 文件之前。例如:
<script type="text/javascript" src="scripts/moment.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.0.1/fullcalendar.min.js"></script>
FullCalendar apparently has some references to the Moment object even before it's instantiated.
FullCalendar 显然在实例化之前就已经对 Moment 对象进行了一些引用。
Hope that helps someone out.
希望能帮助别人。
回答by JuanPabloR
You must check the order of the js.
您必须检查js的顺序。
moment.min.js
fullcalendar.js
lang-all.js
回答by Gneisler
Make sure to include MomentJS first as fullcalendar.js requires this.
确保首先包含 MomentJS,因为 fullcalendar.js 需要这样做。
This was my mistake and I received the same error.
这是我的错误,我收到了同样的错误。
<script src="/includes/js/fullcalendar-2.0.1/lib/moment.min.js"></script>
<script src="/includes/js/fullcalendar-2.0.1/fullcalendar.min.js"></script>
回答by Afzaal Ahmad Zeeshan
I think that the js
file is not present at the location where you are trying to access it from.
我认为该js
文件不存在于您尝试从中访问它的位置。
Please update the href attribute of the source element to the source location where your JS file is present!
请将源元素的 href 属性更新为您的 JS 文件所在的源位置!
For solution, please open the Console and look for the error. It would be 404! Which means file not found.
如需解决,请打开控制台并查找错误。这将是 404!这意味着找不到文件。
For Chrome press CTRL + SHIFT + J
对于 Chrome,请按 CTRL + SHIFT + J