title: Opening popups in jQuery Mobile 1.4.3 after a page transition
body: <p>I know this gets asked again and again and I've partially solved it with other answers. I'm stuck now though.</p>
  
  <p>I'm using popups for a tour of an app. The order of events is:
  1. Press "Next" button.
  2. Close popup
  3. Change page
  4. Open new popup</p>
  
  <p>You can't chain popups so I'm using afterclose. It works fine for the first transition but after that I get no popup. The console.log in this code gives output.</p>
  
  <pre><code>$('#introPanel1Next').click(function(){
    $('#introPanel1').popup({
      afterclose: function(){
        $(":mobile-pagecontainer").pagecontainer("change", "#page2", {
          transition: "slide"
        }).on( "pagecontainershow", function() {
          $('#introPanel2').popup('open');
        });
      }
    }).popup('close');
  });
  
  $('#introPanel2Next').click(function(){
    $('#introPanel2').popup({
      afterclose: function(){
        $(":mobile-pagecontainer").pagecontainer("change", "#page3", {
          transition: "slide"
      }).on( "pagecontainershow", function() {
          $('#introPanel3').popup('open');
        });
      }
    }).popup('close');
  });
  </code></pre>
  
  <p>So I can go from page1 to page2 and have a popup, but even though I can go to page3 introPanel3 does not pop-up.</p>
  
  <p>I thought it might be the event I was listening for (e.g. pagecontainershow) but I've tried them all. Some of them don't give a pop-up on page2 since the page needs to finish loading before the popup("open") is called.</p>
  
  <p>I don't understand why it works for the first transition and popup but not the next (and thus subsequent ones, 5 in total).</p>
  
  <hr>
  
  <p>With regards to an answer below, I've tried this:</p>
  
  <pre><code>$('#introPanel1Next').click(function(){
    $('#introPanel1').popup({
      afterclose: function(){
        $(":mobile-pagecontainer").pagecontainer("change", "#page2", {
          transition: "slide"
        }).on( "pagecontainershow", function() {
          $('#introPanel2', ui.toPage).popup("open");          
        });
      }
    }).popup('close');
  });
  </code></pre>
  
  <p>It doesn't work. :(</p>