<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script data-require="jquery@2.1.4" data-semver="2.1.4" src="https://code.jquery.com/jquery-2.1.4.js"></script>
    <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script src="script.js"></script>
  </head>

  <body>
  <div id="homePage" data-role="page" data-content-theme="a" data-theme="a">
    <div id="header" data-role="header" data-theme="b" data-position="fixed" data-id="myheader" class="ui-state-persist">
    </div><!-- /header -->    
    <div data-role="content" style="padding: 14px 14px 14px 14px;">
    <!-- content goes here! -->
    <p>Click the zero in the footer</p>
    </div>
    
    <div data-role="footer" data-position="fixed" data-theme="a">
      <a href="credits.html" data-position-to="#position-header" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-right ui-btn-b">&nbsp;<span class="unusedCredits">0</span></a>
    </div><!-- /footer -->  
  </div><!-- /homepage -->
  </body>

</html>
$(document).ready(function() {
  $("body").on("pagecontainerbeforeshow", 
    function( event, ui ) {
        console.log("pagecontainerbeforeshow -> Going to: " +ui.toPage[0].id +" From: " +ui.prevPage[0].id);

        switch(ui.toPage[0].id)
        {
          case "homePage":
            break;
          case "creditsPage":
            $("#credits").enhanceWithin().tabs();
            alert("enhanced!");
            break;

        }  
    });
});


/* Styles go here */

<div id="creditsPage" data-role="page"  data-theme="a" data-quicklinks="true">
    <div role="main" class="ui-content">
    <!-- Start of tabs navbar -->
    <div data-role="tabs" id="credits">  
      <div data-role="navbar">
        <ul>
          <li><a href="#buymore" class="ui-btn-active">Buy More</a></li>
          <li><a href="#transfer">Transfer</a></li>
          <li><a href="#history" >History</a></li>
        </ul>
      </div>
      <div id="buymore" class="tab-content">
          <p>Pick your package:</p>
          <p>3 credits = $0.99</p>
      </div>
      <div id="transfer" class="tab-content">
          <p>Donate credits.</p>
          <p>Send credits to a friend.</p>
      </div>
      <div id="history" class="tab-content">
          <p>History</p>
          <p>Starter allotment: 3</p>
      </div>
    </div>
    <!-- end of tabs widget -->
    </div> <!-- end of main -->
    <div data-role="footer" data-position="fixed" data-theme="a">
      <h1>Credits Page</h1>
    </div><!-- /footer -->  
  </div> <!-- end of page -->