gpt4 book ai didi

javascript - 为什么此处不显示 FullCalendar?

转载 作者:行者123 更新时间:2023-12-02 17:08:42 28 4
gpt4 key购买 nike

我正在尝试让一个简单的空日历显示在页面上。我已按照 http://arshaw.com/fullcalendar/docs/usage/ 上的文档进行操作下面的代码看起来没问题,所以应该显示日历。

我在这里做错了什么吗?

更新的代码

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>Calendar</title>

<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

<!-- Custom styles for this template -->
<link rel="stylesheet" href="navbar.css">

<link rel="stylesheet" href="js/fullcalendar-2.0.2/fullcalendar.css">
<link rel="stylesheet" href="js/fullcalendar-2.0.2/fullcalendar.print.css">

<script src="js/fullcalendar-2.0.2/lib/jquery.min.js"></script>
<script src="js/fullcalendar-2.0.2/lib/moment.min.js"></script>
<script src="js/fullcalendar-2.0.2/fullcalendar.min.js"></script>

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<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 class="container">

<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Calendar</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Bookings <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Add</a></li>
<li><a href="#">Delete</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Admin</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</div>

<!-- Main component to show the calendar-->
<div id="calendar"></div>

</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</body>
</html>

屏幕截图

/image/WMUzA.png

最佳答案

当您使用 class 创建 DOM 元素时,您正在使用 id #calendar 的元素调用 fullCalendar() 插件.日历。

所以要么改变这一行:

$('#calendar').fullCalendar();

$('.calendar').fullCalendar()

更改此行:

<div class="calendar"></div>

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

关于javascript - 为什么此处不显示 FullCalendar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25015823/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com