我在mvc app中有这个jQuery datepicker
$("#datepicker").datepicker({
dayNamesMin: ["Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"],
monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
dateFormat: 'dd/mm/yy',
showAnim: "fold"
});
我在这个@ Html.EditorFor
中显示它<div class="form-group">
<div class="col-md-4">
@Html.LabelFor(model => model.fechaEvento, htmlAttributes: new { @class = "control-label" })
<div class="input-group">
<span class="input-group-addon transparent"><span class="glyphicon glyphicon-calendar"></span></span>
@Html.EditorFor(model => model.fechaEvento, null, new { htmlAttributes = new { @class = "form-control left-border-none", @readonly = "readonly", @id = "datepicker", @title = "especifique fecha en que impartirá el evento", @Value = ViewBag.fechaEvento } })
</div>
<p class="help-block">click para especificar fecha</p>
@Html.ValidationMessageFor(model => model.fechaEvento, "", new { @class = "text-danger" })
</div>
从Visual Studio
运行时工作正常但是当我发布应用并通过网络访问时,Datepicker是透明的,很难看到日期并选择一个。
这些是css和脚本
<link href="@Url.Content("/Content/themes/base/jquery-ui.css")" rel="stylesheet">
<link href="@Url.Content("/Content/themes/base/all.css")" rel="stylesheet">
<link href="@Url.Content("/Content/themes/base/base.css")" rel="stylesheet">
<link href="@Url.Content("/Content/themes/base/theme.css")" rel="stylesheet">
<link href="@Url.Content("/Content/themes/base/dialog.css")" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.12.1.js")"></script>
你可以告诉我出了什么问题吗?
答案 0 :(得分:0)
您可以尝试使用CDN版本,当您出于某种原因构建应用时,它显然无法找到.css文件,路径是否合适?大/小写是否正确? jQuery UI的图像在正确的目录中,可以通过代码访问吗?
CDN VERSION
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
而不是
<script src="@Url.Content("~/Scripts/jquery-ui-1.12.1.js")"></script>
并尝试对css检查the complete CDN list here
执行相同的操作https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css