最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap Datepicker is displaying behind popover - Stack Overflow

programmeradmin0浏览0评论

I'm trying to display a datepicker in a popover (using bootstrap and bootstrap-datepicker extension) and having some issues, first I had a problem with displaying the datepicker and found this topic : Datepicker in Popover Won't display ,but now it's displaying behind my popover so it's not fully visible

Here is the HTML code :

<button type="submit" class="btn btn-primary pop_doleance" rel="popover" data-original-title="Ajouter doléance">Ajouter doléance</button>

<div style="display: none" class="pop_doleance_content">
<form class="well form-inline form_doleance">
    <label for="date">Date : </label>
    <input id="date" type="text" class="input-medium">
</form>

And the Javascript code :

var tmp = $.fn.popover.Constructor.prototype.show;
$.fn.popover.Constructor.prototype.show = function (){
    tmp.call(this);
    if (this.options.callback) {
    this.options.callback();
    }
}

$(function (){
    $(".pop_doleance").popover({
        placement:'bottom', 
        html : true, 
        content: function(){return $('.pop_doleance_content').html();},
        callback: function(){$('#date').datepicker();}
    });  
});

Any ideas ?

I'm trying to display a datepicker in a popover (using bootstrap and bootstrap-datepicker extension) and having some issues, first I had a problem with displaying the datepicker and found this topic : Datepicker in Popover Won't display ,but now it's displaying behind my popover so it's not fully visible

Here is the HTML code :

<button type="submit" class="btn btn-primary pop_doleance" rel="popover" data-original-title="Ajouter doléance">Ajouter doléance</button>

<div style="display: none" class="pop_doleance_content">
<form class="well form-inline form_doleance">
    <label for="date">Date : </label>
    <input id="date" type="text" class="input-medium">
</form>

And the Javascript code :

var tmp = $.fn.popover.Constructor.prototype.show;
$.fn.popover.Constructor.prototype.show = function (){
    tmp.call(this);
    if (this.options.callback) {
    this.options.callback();
    }
}

$(function (){
    $(".pop_doleance").popover({
        placement:'bottom', 
        html : true, 
        content: function(){return $('.pop_doleance_content').html();},
        callback: function(){$('#date').datepicker();}
    });  
});

Any ideas ?

Share Improve this question edited May 23, 2017 at 12:02 CommunityBot 11 silver badge asked Jun 3, 2013 at 12:57 DaftDaft 1711 gold badge1 silver badge9 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 8

set popup's z-index to a lower value.

.popup { z-index : 900; }

and set datepicker's container z-index to a higher value like in case of jquery ui datepicker set

.ui-datepicker-div { z-index: 999; }

In the css I added:

.datepicker { 
    z-index: 999 !important;
}

Note the "!important". It did not work without this.

发布评论

评论列表(0)

  1. 暂无评论