Using Bootstrap DatetimePicker with Sweet Alert 2 - Displaying a Warning Calendar

I am using the SweetAlert2 dialog with the form inside. I want to use the Bootstrap DateTimePicker widget.

The calendar widget popup appears in the SweetAlert window instead of the top. This causes the alert to expand and contract — and you must scroll inside the alert to see the calendar. The desired behavior is for the calendar to appear as a child of the main page and display on top of the alert.

https://jsfiddle.net/ghr2bwoc/13/

  swal({
    title: 'Date picker',
    html: '<input id="datepicker">',
    showConfirmButton: false,
    onOpen: function() {
        $('#datepicker').datetimepicker({});
    },

  }).then(function(result) {

  });
+4
source share
2 answers

:

.swal2-overflow {
  overflow-x: visible;
  overflow-y: visible;
}

, customClass.

swal({
  title: 'Date picker',
  html: '<input id="datepicker">',
  showConfirmButton: false,
  customClass: 'swal2-overflow',
  onOpen: function() {
      $('#datepicker').datetimepicker({});
  },

}).then(function(result) {

});
+6

, sweetalert , datetime. (max-height: 550px !important;min-height:550px !important;) @taekwondoalex.

sweetalert, :

swal({
  title: 'Date picker',
  html: '<input id="datepicker">',
  showConfirmButton: false,
  customClass: 'custom-swal-class',
  onOpen: function() {
      $('#datepicker').datetimepicker({});
  },

}).then(function(result) {

});

css , , 550px

.custom-swal-class {
    overflow-x: visible;
    overflow-y: visible;
    max-height: 550px !important;
    min-height: 550px !important;
}
0

Source: https://habr.com/ru/post/1684252/


All Articles