I'm using a multi-page layout for my phonegap application. There are many libraries and I'd like to load them when the logical pages are accessed. Is there an easy way to do this and will it improve performance by keeping the DOM memory lean?
<body>
<!-- Start of first page: #one -->
<div data-role="page" id="one">
</div><!-- /page one -->
<!-- Start of second page: #two -->
<div data-role="page" id="two" data-theme="a">
</div><!-- /page two -->
<!-- Start of third page: #popup -->
<div data-role="page" id="popup">
</div><!-- /page popup -->
</body>