开发者

jQuery datePicker below UI dialog?

开发者 https://www.devze.com 2022-12-08 15:30 出处:网络
See Example After clicking the show container link the datepicker co开发者_运维问答mponent - 2nd input - is shown below the UI dialog. What should I do to show it above the UI dialog?You could set th

See Example

After clicking the show container link the datepicker co开发者_运维问答mponent - 2nd input - is shown below the UI dialog. What should I do to show it above the UI dialog?


You could set the z-index of .ui-datepicker to 1003.

.ui-datepicker
{
  z-index: 1003;
}

Right now, .ui-widget-overlay has a z-index of 1001 and the .ui-dialog has a z-index of 1002. The datepicker has no z-index, and defaults to being below the z-index of these others. Up it to a higher z-index and it should appear above the dialog.


I had a similar problem but the datepicker dialog had a style="z-index:1" which was wreaking me.

So I had to add the !important keyword.

.ui-datepicker {
  z-index: 1003 !important;
}


You need to set the z-index on the datepicker, e.g.:

.ui-datepicker 
{
    z-index:20000;
}

Should work for you.


If the its an old browser (IE6) you may need the 'BGIFrame' plugin and set the dialog option to use it, if the z-index didn't work?


I've fixed by adding this on JS

  //allow interaction of select2, date and time picker on jQuery UI dialog
    $.ui.dialog.prototype._allowInteraction = function(e) {
    return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length;
  };
0

精彩评论

暂无评论...
验证码 换一张
取 消