【发布时间】:2018-06-16 18:30:28
【问题描述】:
由于长期以来我一直在努力更改 Datepicker 锚位置,但没有得到任何解决此问题的方法。
datepicker的图片如下,
这里我想将锚点位置从左到中更改可以吗?
我尝试通过使用 datepicker 的 Orientation 属性来修复它,比如
$('body').on('focus', "#datepickerDay", function () {
$(this).datepicker({
autoclose: true,
endDate: Infinity, format: 'dd-mm-yyyy', orientation: 'auto '
}).prop('type', 'text').on('changeDate', function (ev) {
if (Datepickerflag == 0) {
var newDate = new Date(ev.date);
splitValidation(newDate);
Datepickerflag = 1;
}
});;
Datepickerflag = 0;
});
而 Html 代码是,
var input = document.createElement("input");
input.type = "text";
input.id = "datepickerDay";
input.style.width = "70px";
input.style.marginRight = "45px";
input.style.borderLeft = "none";
input.style.borderRight = "none";
input.style.borderTop = "none";
input.style.borderWidth = "2px";
input.style.position = "absolute";
input.style.right = "45px";
input.style.top = "155px";
document.getElementById("leftright").appendChild(input);
我也尝试过应用另一个选项,但我还没有找到将锚点位置设置为中心的属性。
在此先感谢..!
【问题讨论】:
-
您的意思是打开引导程序,然后在日期选择器出现时。锚必须在“月”?
-
不正好在月份,在输入中间。
-
是的,我尝试过应用 css。但它不会工作。
-
你能用 bootstrap datepicker 的示例 sn-p 来编辑问题吗?我想我有解决办法
-
我需要一个“工作日期选择器”,这就是我问你一个 sn-p 的原因。您可以在编辑工具上创建一个 sn-p
标签: jquery html css twitter-bootstrap datepicker