Open vasyaabr opened 7 years ago
hi
you could try adding an id to the <div class="form-group">
so it becomes <div class="form-group" id="birthDateContainer">
and then add container: '#birthDateContainer' to the datepicker function so it becomes
$(function() {
$('#BirthDate').datepicker({
format: "mm.dd.yyyy",
startDate: "-100y",
language: "ru",
orientation: "auto",
autoclose: true,
todayHighlight: true,
toggleActive: true,
defaultViewDate: { year: 2016, month: 1, day: 1 },
container: '#birthDateContainer'
});
});
that should do it... well it did for me anyway.
Sorry, but it didn't work :( Datepicker still positioned on the left top corner of the page.
@vasyaabr
i have same issue.
It happens because you use:
body{ margin: 0 auto; }
current version calculate this margin value wrong.
ugly fix for it - in bootstrap-datepicker.js - >place: function():
var left = offset.left - appendOffset.left,
replace it on:
var left = offset.left,
Yesssss! @MalakhovI , you save me :)
See also #1371
I would recommend to not overwrite directly the plugin's code, you can do this by using this overwrite here:
$.fn.datepicker.Constructor.prototype.place = function() {
console.log("overwritten");
}
@MalakhovI Is there a similar fix for the bootstrap-datepicker.min version? The code does not exist in that version.
Extended issue explanation is here: http://stackoverflow.com/questions/40780204/bootstrap-datepicker-positioned-on-the-left-top-corner-of-the-page
Expected behaviour
On click on the input, datepicker should be positioned near the input element.
Actual behaviour
Datepicker positioned on the left top corner of the page
Datepicker version used
Tested with latest stable and v1.7.0-dev.
Example code
Yo can view example page here: https://abonent.pskovregiongaz.ru/Gro/AskForVDGO Code below was cleared from unneccesary details.