简体   繁体   English

Bootstrap datetimepicker样式无法正常显示

[英]Bootstrap datetimepicker style not displaying properly

I'm trying to use bootstrap-datetimepicker but I can't make it show properly. 我正在尝试使用bootstrap-datetimepicker但我无法正确显示它。 I followed the installation part of the tutorial. 我按照教程的安装部分进行操作。

Screenshot 截图

My result : 我的结果:

风格未应用

The example from the doc : 来自doc的示例:

在此输入图像描述

HTML HTML

<div class="form-group">
    <div class="input-group date">
        <label class="input-group-addon" for="add-event-start"><span class=
        "glyphicon glyphicon-calendar"></span></label><input class=
        "form-control" id="add-event-start" name="start" type="text">
    </div>
</div>

Javascript 使用Javascript

$('#add-event-start').datetimepicker({
    allowInputToggle: true,
    locale: 'fr',
    icons: {
        time: "fa fa-clock-o",
        date: "fa fa-calendar",
        up: "fa fa-arrow-up",
        down: "fa fa-arrow-down",
    },
});

Head

<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/fullcalendar.min.css">
<link rel="stylehseet" href="css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.8.3-respond-1.4.2.min.js"></script>

Body 身体

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/vendor/validator.min.js"></script>
<script src="js/vendor/moment/moment.min.js"></script>
<script src="js/vendor/moment/fr.min.js"></script>
<script src="js/vendor/fullcalendar/fullcalendar.min.js"></script>
<script src="js/vendor/fullcalendar/fr.min.js"></script>
<script src="js/vendor/typeahead.bundle.min.js"></script>
<script src="js/vendor/bootstrap-datetimepicker.min.js"></script>

I tried to remove some includes to prevent conflicts but i had the same result. 我试图删除一些包含以防止冲突,但我有相同的结果。 Can someone tell what I am doing wrong ? 有人能说出我做错了吗?

I get the same results as your picture when I neglect to include or disable the Bootstrap Datepicker CSS stylesheet. 当我忽略包含或禁用Bootstrap Datepicker CSS样式表时,我得到与图片相同的结果。 (Step 6 of the guide ): 指南的第6步):

<link rel="stylesheet" href="/path/to/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />

In your sample code the tag seems to be present in your header, but you must make sure it's loaded as well. 在您的示例代码中,标记似乎存在于标题中,但您必须确保它也已加载。 Maybe the path or the file itself is wrong. 也许路径或文件本身是错误的。

I get exactly the same thing! 我得到完全一样的东西! :( :(

However, if you use the versions of bootstrap-datetimepicker.css and bootstrap-datetimepicker.js from the demo site it works. 但是,如果您使用演示站点中的bootstrap-datetimepicker.css和bootstrap-datetimepicker.js版本,则可以使用。

The versions on the demo site are 4.15.35 and not the latest 4.17.37 available from GitHub... 演示站点上的版本是4.15.35,而不是GitHub提供的最新版本4.17.37 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM