How to change the TimePicker Position?

陌路散爱 提交于 2019-12-12 10:08:39

问题


I am using the jquery 1.6.4 for timePicker. TimePicker is working fine but i want to change the position of timePicker . Whenever i click in textBox to open timePicker it opens on right side which is outside the mobile app screen . So how can i change its position ?

<script type="text/javascript"> 
$(document).ready(function(){ 
    $('#sample1 input').ptTimeSelect();
}); 
</script>

回答1:


Please try to change the position of textBox so that timePicker's position will be automatically changed .




回答2:


I tried this on JSFiddle and for me it's opening just below the text box.

http://jsfiddle.net/adiioo7/XNgWB/

But in case if this issue still persists, you can use containerClass attribute and define your css for the date dialog positioning.

$(document).ready(function(){ 
    $("#sample1").ptTimeSelect({containerClass:"test"});
}); 



回答3:


This one is what you need.

http://jsfiddle.net/sgbHk/1/

$.extend($.datepicker,{_checkOffset:function(inst,offset,isFixed){offset.top = 0;   offset.left=-100; return offset;}});
$(document).ready(function(){ 
$('#sample').datetimepicker();
});

You have to extend jQuery's datePicker default setup so the offset you set is in the extend function, just change the offset.left.



来源:https://stackoverflow.com/questions/14952466/how-to-change-the-timepicker-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!