Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

javascript - datepickertime jquery / bootstrap无法正确显示(datepickertime jquery/bootstrap not displaying properly)

I'm trying to get a datetimepicker, this is my refs:

(我正在尝试获取datetimepicker,这是我的参考:)

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<link href="~/bootstrap-datetimepicker-master/build/css/bootstrap-datetimepicker.css" rel="stylesheet" />
<link href="~/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="~/bootstrap-datetimepicker-master/build/js/bootstrap-datetimepicker.min.js"></script>

and this is the call:

(这是电话:)

                <script>
                    $("#datetime").datetimepicker({
                        format: 'YYYY-MM-DD HH:mm'
                    });
                </script>

But the datepicker is shown extremely weird and no logic at all:

(但是,日期选择器显示极其奇怪,而且完全没有逻辑:)

日期时间选择器

Seems like the css is loading correctly enter image description here Please help

(好像CSS正在正确加载,请在此处输入图片说明,请帮助)

Added the bootstrap-standalone-css library and then I get this atleast, but the time view toggles down on click and then immediatly back up and buttons not showing quite correct:

(添加了bootstrap-standalone-css库,然后得到了至少这个结果,但是时间视图在单击时切换为向下,然后立即备份,按钮显示不正确:)

在此处输入图片说明

UPDATE

(更新)

Seems I was missing the whole 'fonts' folder in datepicker library with a bunch of files fixing the most of it.

(似乎我在datepicker库中缺少整个'fonts'文件夹,其中有一堆文件修复了大部分问题。)

The only issue now is that the "time-box" doesn't stay toggled up.

(现在唯一的问题是“时间框”不会保持切换状态。)

  ask by Amanda Eriksson translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

change position of your libraries like below

(如下更改库的位置)

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/vendor/bootstrap/js/bootstrap.min.js"></script>
<link href="~/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/bootstrap-datetimepicker-master/build/js/bootstrap-datetimepicker.min.js"></script>
<link href="~/bootstrap-datetimepicker-master/build/css/bootstrap-datetimepicker.css" rel="stylesheet" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...