简体   繁体   English

Zebra DatePicker定位问题

[英]Zebra DatePicker Positioning Issue

I am developing an app in asp.net in which I am using the Jquery Zebra DatePicker but the issue is this, I am opening the form in Jquery dailog and calendar will open on the dialog but datepicker is opening at the bottom of the page, same problem is reported here but I am unable to understand how to modify the function. 我在asp.net中开发一个应用程序,我在其中使用Jquery Zebra DatePicker,但问题是这样,我在Jquery dailog中打开表单,日历将在对话框中打开但是datepicker在页面底部打开, 这里报告同样的问题但我无法理解如何修改该功能。 Kindly tell me solution or purpose me some other plugin which is same as ajax calender extender. 请告诉我解决方案或目的我一些其他插件,与ajax压延机扩展器相同。 Thanks in advance. 提前致谢。

I recently have the same problem. 我最近有同样的问题。 But a little delay (timeout) solves the issue for me: 但是有点延迟(超时)为我解决了这个问题:

jQuery(document).ready(function($){
    window.setTimeout(function(){
        $('input.datepicker').Zebra_DatePicker();
    }, 100);
});

Sorry for the delayed reply... Anyways I will like to improve this answer. 对不起延迟回复...无论如何,我想改进这个答案。 I had the same problem but in my case it occurred due to the icon's position in the date textbox. 我有同样的问题,但在我的情况下,它是由于图标在日期文本框中的位置而发生的。 If you just want to update the icon's position, simply call the update method without any arguments: 如果您只想更新图标的位置,只需调用update方法,不带任何参数:

var datepicker = $('element').data('Zebra_DatePicker'); var datepicker = $('element')。data('Zebra_DatePicker'); datepicker.update(); datepicker.update();

We can control the Zipra Datepicker positions by changing the default_position and container attributes 我们可以通过更改default_position容器属性来控制Zipra Datepicker位置

Zipra Datepicker has default_position attribute, We can use this default_position attribute to display the calendar above or below of the input box. Zipra Datepicker具有default_position属性,我们可以使用此default_position属性显示输入框上方或下方的日历。

  • Default position -> above / below 默认位置 - > 上/下

Zipra Datepicker default position is above, it means calendar will display right top of the input box. Zipra Datepicker默认位置在上方,表示日历将显示在输入框的右上方。


The second option is the container, the calendar will display relative to the container element. 第二个选项是容器,日历将相对于容器元素显示。

  • container: $('body') , container: $('body')

By default, the container will be the body which means the date picker will append related to the body, You can see the date picker HTML code at the top of the DOM 默认情况下,容器将是body ,这意味着日期选择器将附加到主体,您可以在DOM的顶部看到日期选择器HTML code

You can change the container position relative to the parent of your input box by adding the class name of parent div in the container section. 您可以通过在容器部分中添加父div的类名来更改相对于输入框的父级的容器位置。

 $('#datepicker-on-change').Zebra_DatePicker({ default_position: 'below', container : $('.datepicker-position') }); 
 <div class="datepicker-position"> <input id="datepicker-on-change" type="text" class="form-control" data-zdp_readonly_element="false"> </div> 

Add the following in your css class for it is (Zebra_DatePicker): 在你的css类中添加以下内容(Zebra_DatePicker):

    .Zebra_DatePicker{
    position: absolute;
    } 

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

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