title: How to swipe between several jquery mobile pages?
body: <p>Here is the code extract which works well with 2 pages:</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
    $(document).ready(function() {
      window.now = 1;
  
      $('#device1').live("swipeleft", function(){
          window.now++
          $.mobile.changePage("#device"+window.now, "slide", false, true);
      });
      $('#device2').live("swiperight", function(){
          window.now--;
          $.mobile.changePage("#device"+window.now, "slide", true, true);
      });    
  
    });
  &lt;/script&gt; 
  
  ...
  &lt;div data-role="page" id="device1"&gt;
  ...
  &lt;/div&gt;&lt;!-- /page --&gt;
  &lt;div data-role="page" id="device2"&gt;
  ...
  &lt;/div&gt;&lt;!-- /page --&gt;
  </code></pre>
  
  <p>How can I make it more universal to work with huge number of pages?</p>