简体   繁体   English

jquery移动日期箱自定义对齐

[英]jquery mobile datebox custom alignment

I am currently using jquery mobile datebox (http://dev.jtsage.com/jQM-DateBox/) to display a calendar. 我目前正在使用jquery mobile datebox(http://dev.jtsage.com/jQM-DateBox/)来显示日历。 I stuck the input in a div with display: none, and then I manually activate the calendar with the following javascript: 我将输入卡在显示:none的div中,然后使用以下javascript手动激活日历:

$('#opencalendarlink').live('click', function(){
    $('#datepicker').datebox('open');
});

where opencalendarlink is the id of the button and date picker is the id of the calendar. 其中opencalendarlink是按钮的id,日期选择器是日历的id。 However, the calendar appears now left aligned, although the button and corresponding hidden div are center aligned. 但是,日历现在显示为左对齐,但按钮和相应的隐藏div是居中对齐的。 How can I fix this? 我怎样才能解决这个问题?

Please try 请试试

    <div style="visibility:hidden; height: 0px;">
    <label for="mydate">Some Date</label>

    <input name="mydate" id="mydate" type="date" data-role="datebox"
       data-options='{"mode": "calbox"}'>
    </div>

jQM-DateBox calculates its position probably from it's parent and because it isn't rendered (because of the display:none) this will be 0,0, setting visibility will fix this jQM-DateBox可能从它的父级计算它的位置,因为它没有渲染(因为显示:无)这将是0,0,设置可见性将解决这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM