Freeze background when calling Popup?

Asked

Viewed 519 times

2

What would be the best way to freeze background processing when a popup is called ?

<h:link onclick="showModalPopUp(); return false;">link
</h:link>

The best way to pause screen processing while popup is running, when closed, rewind processing ?

var popUpObj;
        function showModalPopUp() {  

            popUpObj = window.open("pagina.xhtml,
                "ModalPopUp",
                "toolbar=no," +
                "scrollbars=no," +
                "location=no," +
                "statusbar=no," +
                "menubar=no," +
                "resizable=0," +
                "width=650," +
                "height=550"
             );

2 answers

2

If I understand your question correctly, you’re referring to "Modal," correct? If so, test this code below. It is a bootstrap application. Demo

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Exemplo de Modal</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Modal Examplo1</h2>

  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Abrir Modal</button>


  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal conteudo-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Conteúdo do seu modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
        </div>
      </div>

    </div>
  </div>

</div>

</body>
</html>
  • It would be exactly like this, is that the page that calls this modal, has a setInterval, wanted to stop processing, when to call it and only back processing when close it

1


I did it in a very simple way, just checking when my modal was closed.

As an example:

var win = window.open('http://www.google.com', 'google','width=800,height=600,status=0,toolbar=0');   
var timer = setInterval(function() {   
    if(win.closed) {  
        clearInterval(timer);  
        alert('closed');  
    }  
}, 1000); 

While it was not closed I do not run the processing of my setInterval in the background.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.