Looking at the source for home.html
, it seems that you haven't included js/plugins.js
, only js/index.js
.
I know you've included it in shapes.html
, but JQM is a bit weird about loading external scripts when loading a page via ajax, as stated in the documentation:
The simplest approach when building a jQuery Mobile site is to reference the same set of stylesheets and scripts in the head of every page. If you need to load in specific scripts or styles for a particular page, we recommend binding logic to the pageinit event (details below) to run necessary code when a specific page is created (which can be determined by its id attribute, or a number of other ways). Following this approach will ensure that the code executes if the page is loaded directly or is pulled in and shown via Ajax.
Edit: You can not call any functions that modify the DOM until it is fully loaded. This is signaled in JQM by the pageinit
event. Read about scripting and events for more info.
Try surrounding your javascript for shapes.html
with
$( document ).delegate("#shapesPage", "pageinit", function() {
...
});