Close modal in the REMODAL plugin

1

I'm using the Remodal plugin for VodkaBears,

  

link

I open a modal with it and within the modal I have an iframe, I wanted to know how I close the modal from a button inside the Iframe?

Modal HTML:

<div class="remodal" data-remodal-id="modal" data-remodal-options="closeOnAnyClick: false, closeOnEscape:false" style="width: 700px; height: 700px;">
    <h1>Galeria</h1>
    <iframe src="galeria.html" frameborder="0" height="550" width="600"></iframe>
</div>

HTML gallery.html

<!doctype html>
<html lang="pt-Br">
<head>
<meta charset="UTF-8">
<title>Galeria de Produtos</title>
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body style="background-color: transparent;">
<div class="container">
<div class="row">
    <div class="col-xs-4">
        <img src="foto.jpg" alt="" class="thumbnail"/>
        <input type="button" value="Fechar Modal" class="btn btn-primary"/>
    </div>
</div>
</div>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
    
asked by anonymous 31.03.2015 / 20:11

1 answer

0

You do not indicate how you are instantiating remodeling , but you will be able to deal with your problem as follows:

// instanciar remodal
var inst = $.remodal.lookup[$('[data-remodal-id=modal]').data('remodal')];

// abrir modal
inst.open();

// detetar clique para fechar modal
var iframe = $('#idDaIframe').contents();

iframe.find("#idDoBotao").click(function(){
    inst.close();
}); 
    
31.03.2015 / 20:52