twitter-bootstrap Bootstrap 3 日期时间选择器小部件位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32547737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:09:26  来源:igfitidea点击:

Bootstrap 3 datetimepicker widget position

twitter-bootstrapbootstrap-datetimepicker

提问by Jigar Naik

I am using bootstrap 3 diatomite picker widget, but I am unable to control its position. Right now the widget appears at the bottom of my page when I don't use horizontal and vertical options, but when I use horizontal and vertical options I get an error saying horizontal is not a valid option.

我正在使用 bootstrap 3 硅藻土选择器小部件,但我无法控制它的位置。现在,当我不使用水平和垂直选项时,小部件出现在我的页面底部,但是当我使用水平和垂直选项时,我收到一条错误消息,说水平不是有效选项。

These options are not working for me:

horizontal: 'right',
vertical: 'top'

这些选项对我不起作用:

水平:'右',
垂直:'顶部'

Here is my code:

这是我的代码:

enter code here
<input type="text" value="<fmt:formatDate value="${visitDetail.visitDate }" pattern="dd-MM-yyyy hh:mm aaa" />" name="patient.visitDetails[${status.index}].visitDate" class="form-control" id="visitDate${status.index}" placeholder="visitDate${status.index}"> 


<script type="text/javascript">
    $(function () {
        $("#visitDate${status.index}").datetimepicker({
            showTodayButton: true,
            inline: false,
            format: "DD-MM-YYYY hh:mm A",
            sideBySide: true,
            horizontal: 'right',
            vertical: 'top'
        });
    });
</script>

回答by Jason Tate

horizontaland verticalshould be used as parameters of the widgetPositioningoption. See http://jsfiddle.net/spasticdonkey/qmauopp0/3/

horizontal并且vertical应该用作widgetPositioning选项的参数。见http://jsfiddle.net/spasticdonkey/qmauopp0/3/

$(function () {
    $('#datetimepicker1').datetimepicker({
        showTodayButton: true,
        format: "DD-MM-YYYY hh:mm A",
        sideBySide: true,
        widgetPositioning: {
            horizontal: 'right',
            vertical: 'top'
        }
    });
});

回答by Matias Scheel

$('.date').datetimepicker({
    language: 'es',
    format: 'dd/mm/yyyy',
    autoclose: 1,
    weekStart: 1,
    startView: 2,
    todayBtn: 1,
    todayHighlight: 1,
    forceParse: 0,
    minView: 2,
    pickerPosition: "top-left"
});