Datepicker z-index problem inside modal
See original GitHub issueWhen you put the boostrap datepicker inside a boostrap modal, the popup shows behind the modal.
This occurs because the code assumes the first element as the bigger zIndex inside the place function:
var zIndex = parseInt(this.element.parents().filter(function(){
return $(this).css('z-index') !== 'auto';
}).first().css('z-index'))+10;
The FIX:
Iterate over all parents to discover the biggest zIndex:
Here is my code:
var biggestZIndex = 0;
this.element.parents().each(function(index, parent) {
var zIndex = $(parent).css('z-index');
if (zIndex !== 'auto') {
var zIndex = parseInt(zIndex);
if (zIndex > biggestZIndex) {
biggestZIndex = zIndex;
}
}
});
var zIndex = biggestZIndex + 10;
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Datepicker on Modal (z-index) - Stack Overflow
I don't see any other reason why the date picker would not show inside the modal. I guess we need more details. If...
Read more >10569 (Incorrect z-index position of Datepicker in some cases)
This means modal window has z-index equals 1050, but modal's parent DIV has z-index equals 1060! The cause of the incorrect z-index of...
Read more >DatePicker problem in modal window and a solution
To use the DatePicker in modal windows causes some problems with the z-Index. First the DatePicker produces scrollbars if the modal window ist...
Read more >Datepicker in modal with higher z-index than animation ...
Hi,. Ran in to an issue here. To avoid modals getting hidden behind animation containers, we use a class for a div and...
Read more >Getting a calendar to display infront of a modal - Laracasts
... for my datepicker. The issue I'm having is that when I open up the calendar, the calendar ends up being hidden inside...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I fix it temporally with:
.datepicker{z-index:9999 !important}
I fixed with
ul.uib-datepicker-popup.dropdown-menu.ng-scope { z-index: 1090 !important; }