Preloading on first page load

Preloading on first page load

I'm using the multipage template, so only just one html file. Now I want the whole page to have a preloading and not only showing a white page before the content is displayed. I figured out that jquerymobile already is using a loading function so I tried to use it like this:

javascript:;
  1. javascript:; $(document).ready(function() {
  2. $.mobile.loading( 'show', {
  3. text: 'page loading',
  4. textVisible: true,
  5. theme: 'a'
  6.  });
  7. });
But it's not working! 

I've put it directly after the jquerymobile include. Can somebody help me please?