Home  >  Q&A  >  body text

javascript - In an iframe subpage, the modal layer of the parent page opened through window.parent.document cannot be closed normally

Hello everyone, I would like to ask about opening the modal layer of the parent page through window.parent.document in the iframe sub-page, so that the modal closing method $("#modal").modal("hide") of the parent page cannot be closed normally. ,Does anyone know the reason for this

阿神阿神2663 days ago1134

reply all(3)I'll reply

  • 欧阳克

    欧阳克2017-07-05 11:08:17

    你在子页面里$("#modal").modal("hide")肯定不能关闭呀!
    你可以在子页面里调用父页面的一个方法,这个方法里写$("#modal").modal("hide")!

    reply
    0
  • 漂亮男人

    漂亮男人2017-07-05 11:08:17

    $('#id', window.parent.document).modal('hide');

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-07-05 11:08:17

    Finally, we adopted a not-so-good method to solve it temporarily. Show first and then hide, $("#modal").modal("show").modal("hide"). This can solve the problem, but the pop-up layer is closed. Sometimes it will flash due to show, but I haven’t found a good solution yet

    reply
    0
  • Cancelreply