gpt4 book ai didi

javascript - 完整日历未在页面上显示/加载

转载 作者:行者123 更新时间:2023-11-28 01:16:11 26 4
gpt4 key购买 nike

我试图在我的网页上实现一个完整的日历,尽管当我导航到它应该在的页面时,它根本不显示。

这是我的代码:

@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/fullcalendar")

@{
ViewBag.Title = "Index";
}

<h2>Forecasts</h2>

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

<script>
$(document).ready(function() {

// page is now ready, initialize the calendar...

$('#calendar').fullCalendar({
// put your options and callbacks here
weekends: false // will hide Saturdays and Sundays
})

});
</script>

这是每个渲染包中的内容:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/fullcalendar").Include(
"~/Scripts/moment.js",
"~/Scripts/fullcalendar.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/fullcalendar.css",
"~/Content/site.css"));

库版本:

jquery - 1.11.3
moment - 2.11.2
fullcalendar - 2.4.0
bootstrap - 3.0.0

非常感谢任何帮助。

编辑:在下面添加了一段呈现的 HTML 代码。注意:所有敏感信息均已替换为“#”。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index - ###</title>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/fullcalendar.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>

<script src="/Scripts/modernizr-2.6.2.js"></script>

</head>
<body>
<div class="navbar navbar-inverse">
<div class="container-fluid">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img src="/Resources/logo.png" width="75" height="35" alt="Logo" />
</a>
</div>
<p class="nav navbar-text navbar-right">
User: ###<br />
Date: ###
</p>
</div>
</div>
</div>

<div class="navbar navbar-default">
<div class="container-fluid">
<div class="container">
<ul class="nav navbar-nav">
<li><a href="/">#</a></li>
<li><a href="/#/#">#</a></li>
<li><a href="/#/#">#</a></li>
<li><a href="/#">#</a></li>
<li><a href="/#">#</a></li>
</ul>
</div>
</div>
</div>

<div class="container body-content">

<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/fullcalendar.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>

<script src="/Scripts/jquery-1.11.3.js"></script>

<script src="/Scripts/moment.js"></script>
<script src="/Scripts/fullcalendar.js"></script>

<h2>#</h2>

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

<script>
$(document).ready(function() {

// page is now ready, initialize the calendar...

$('#calendar').fullCalendar({
// put your options and callbacks here
weekends: false // will hide Saturdays and Sundays
})

});
</script>



<hr />
<footer>
<p>&copy; 2016 - #.</p>
</footer>
</div>

<script src="/Scripts/jquery-1.11.3.js"></script>

<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/respond.js"></script>

</body>
</html>

最佳答案

我设法解决了我自己的问题,我相信 fullcalendar 和 bootstrap/respond.js 存在某种冲突。

在我的共享 View 文件夹中,这些脚本在页面末尾呈现(我没有意识到)。

我删除了这些并且工作正常。

下方显示了渲染包,下方显示了属于该包的脚本。

Scripts.Render("~/bundles/bootstrap")
RenderSection("scripts", required: false)

<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/respond.js"></script>

关于javascript - 完整日历未在页面上显示/加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35605883/

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