jQuery移动日期框自定义对齐 [英] jquery mobile datebox custom alignment

查看:83
本文介绍了jQuery移动日期框自定义对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用jquery移动日期框(http://dev.jtsage.com/jQM-DateBox/)显示日历.我将输入内容固定在带有display:none的div中,然后使用以下javascript手动激活日历:

I am currently using jquery mobile datebox (http://dev.jtsage.com/jQM-DateBox/) to display a calendar. I stuck the input in a div with display: none, and then I manually activate the calendar with the following javascript:

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

其中opencalendarlink是按钮的ID,日期选择器是日历的ID.但是,日历现在显示为左对齐,尽管按钮和相应的隐藏div居中对齐.我该如何解决?

where opencalendarlink is the id of the button and date picker is the id of the calendar. However, the calendar appears now left aligned, although the button and corresponding hidden div are center aligned. How can I fix this?

推荐答案

请尝试

    <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可能从其父级计算其位置,并且由于未渲染(由于display:none),因此该值为0,0,设置可见性将解决此问题

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

这篇关于jQuery移动日期框自定义对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆