Issue: The problem I'm facing is that after clicking on the label where the date should be entered, the calendar is not appearing as expected. I tried using a jQuery script to darken the background, but then the calendar is not displaying in the correct position. I attempted to use the offset() function, but it doesn't seem to be working:
(part of) Code :
< script > // code with issue
$(document).ready(function() {
//Get
var p = $(".e_darker");
var offset = p.offset();
//set
$(".calendar_in_place").offset({
top: offset.top,
left: offset.left
});
}); <
/script>
<
script > // scrolls down page to input label
$(function() {
$("#radio_eventi").click(function() {
$('html,body').animate({
scrollTop: $("#radio_eventi").offset().top
},
'slow');
});
}); <
/script> <
script > // makes dark background appear/dissapear
$(document).ready(function() {
$(".e_darker").click(function() {
if ($("#darker").show(150)) {
$(document).mouseup(function() {
$("#darker").hide(150);
});
$(".e_darker").mouseup(function() {
$("#darker").hide(150);
});
} else {
$("#darker").show(150);
}
});
}); <
/script>
.calendar_in_place {
top: 0 !important;
left: 0 !important;
}
.in-front {
z-index: 6;
}
#darker {
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.5;
display: none;
transition: opacity 0.15s linear;
z-index: 5;
}
<head></head>
<body>
<div id="darker"> </div>
<!-- div that makes background darker -->
<!-- imput label -->
<section id="eventi_spec" class="nascondi">
<div class="form-group">
<label for="datetimepicker11" class="label_no_middle">Data di avvio dell'evento</label>
<input type="text" placeholder="GG/MM/AAAA" data-mask="99/99/9999" class="form-control in_front e_darker" id="datetimepicker11">
</div>
</body>
Site uses Bootstrap.