如何将日期选择器从右向左对齐? [英] how align the datepicker right to left?
问题描述
//datepicker
$('dob').on('click',function(){
$('.datepicker').datepicker({
"format": "dd/mm/yyyy",
"autoclose": true
});
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.1/css/datepicker.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.3/js/bootstrap-datetimepicker.min.js"></script>
<link href="assets/css/common-rtl.min.css" rel="stylesheet" type="text/css" />
<form class="form-horizontal" action="employee.cfm" method="post" role="form">
<div class="container col-md-12">
<div class="col-md-8 jumbotron">
<div class="form-group">
<label class="control-label col-sm-3" for="dob">تاریخ پیدائش</label>
<div class="controls col-sm-3">
<input type="text" id="dob" name="dob" placeholder="DOB" class="form-control datepicker" value="">
</div>
</div>
</div>
</div>
</form>
我用阿拉伯语创建了一个页面,页面的内容是从右到左.在文本字段中,我添加了一个datePicker,它没有正确对齐.
I have created a page in arabic language the content of the page were right to left.In a text field, I have added a datePicker which is not aligned correctly.
我为此使用了commenrtl.css.
I have used commenrtl.css for this.
推荐答案
Bootstrap datepicker具有方向选项.您可以使用它将其放置在左侧:
Bootstrap datepicker has an orientation option. You can use this to place it left:
//datepicker
$('dob').on('click',function(){
$('.datepicker').datepicker({
"format": "dd/mm/yyyy",
"autoclose": true,
"orientation": left
});
});
http://bootstrap-datepicker.readthedocs.org/en/Latest/options.html#orientation
如果这样做没有帮助,您可以始终使用css转换来翻转元素:
transform: rotateY(130deg);
尽管它在IE9及更低版本中不起作用.
If that doesn't help you could always use a css transform to flip an element:
transform: rotateY(130deg);
Though it doesn't work in IE9 and lower.
https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform
这篇关于如何将日期选择器从右向左对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!