简体   繁体   English

在模式中启动模式

[英]Launch modal in modal

I want to launch a modal in a modal. 我想在模式中启动一个模式。 It's actually working, but if I open the 2nd modal in the 1st modal, the 2nd modal appears, but behind the 1st modal and the scroll bar disappear, when I close the 1st modal: modal 它实际上在工作,但是如果我在第一个模态中打开第二个模态,则会出现第二个模态,但是当我关闭第一个模时,在第一个模态之后,滚动条消失了:

The JavaScript is in my modal PHP file. JavaScript在我的模式PHP文件中。

How can I solve this problem? 我怎么解决这个问题?

Javascript Java脚本

$(document).ready(function() {
  $('.relations').click(function(e) {
    var checkBoxes = $("input[name=case]");
    var checkedBoxes = checkBoxes.filter(":checked");

    if (checkedBoxes.length === 0) {
      return false;
    }
    e.preventDefault();

    var insert = [];

    $('.checkboxes').each(function() {
      if ($(this).is(":checked")) {
        insert.push($(this).val());
      }
    });
    insert = insert.toString();

    var data_id = $(this).attr("id");
    $.ajax({
      url: "nodes.php",
      method: "post",
      dataType: "json",
      data: {
        data_id: data_id,
        insert: insert
      },
      success: function(data) {
        $('#moreInfo').html(data);
        $('#dataModal').modal("show");
        var nodeDatas = new vis.DataSet();
        nodeDatas = data;

        $.ajax({
          method: "post",
          dataType: "json",
          url: "edges.php",
          data: {
            data_id: data_id
          },
          success: function(data) {
            var edgeDatas = new vis.DataSet();
            edgeDatas = data;
            var myDiv = document.getElementById("moreInfo");

            data = {
              nodes: nodeDatas,
              edges: edgeDatas
            };

            var options = {
            };
            var network = new vis.Network(myDiv, data, options);
          }
        });
      }
    });
  });
});

I'm assuming that the second modal is moreInfo div, if that's correct, you need to make few css changes for that element to appear on top of the first modal, using z-index:99999; 我假设第二个模态是moreInfo div,如果是正确的话,您需要使用z-index:99999进行少量的CSS更改,使该元素出现在第一个模态的顶部。 maybe more, and also for the scrollbar to appear you need another css property overflow:scoll; 也许更多,并且要使滚动条出现,您还需要另一个css属性溢出:

I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM