Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hmm, I modified it a little but your code looks good to me. Here is a live example of what I have: </p> <ul> <li><a href="http://jsfiddle.net/phillpafford/gkPAG/22/" rel="nofollow">http://jsfiddle.net/phillpafford/gkPAG/22/</a></li> <li><a href="http://jsfiddle.net/phillpafford/gkPAG/28/" rel="nofollow">http://jsfiddle.net/phillpafford/gkPAG/28/</a> &lt;-- Display elements heights after adjustments</li> </ul> <p>JS:</p> <pre><code>$('#pWhereAmI').live('pageshow',function(event, ui) { canvasHeight = $('#map_canvas').height(); // initialize the canvas height pageFreeHeight = pageFreeHeight_calc('#pWhereAmI'); map_canvasHeight = canvasHeight + pageFreeHeight; $('#map_canvas').height(map_canvasHeight).page(); }); function pageFreeHeight_calc(pageSelector) { var pageHeight = null; var headerHeight = 0;; var contentHeight = 0; var footerHeight = 0; if($(pageSelector).height != null) { pageHeight = $(pageSelector).height(); } if($(pageSelector+' [data-role|="header"]').outerHeight(true) != null) { headerHeight = $(pageSelector+' [data-role|="header"]').outerHeight(true); } if($(pageSelector+' [data-role|="content"]').outerHeight(true) != null) { contentHeight = $(pageSelector+' [data-role|="content"]').outerHeight(true); } if($(pageSelector+' [data-role|="footer"]').outerHeight(true) != null) { footerHeight = $(pageSelector+' [data-role|="footer"]').outerHeight(true); } alert( 'pageHeight: ' + pageHeight + "\n" + 'headerHeight: ' + headerHeight + "\n" + 'contentHeight: ' + contentHeight + "\n" + 'footerHeight: ' + footerHeight + "\n" + 'returnValue: ' + (pageHeight - headerHeight - contentHeight - footerHeight) ); return pageHeight - headerHeight - contentHeight - footerHeight; } </code></pre> <p>HTML:</p> <pre><code>&lt;div data-role="page" id="home"&gt; &lt;div data-role="content"&gt; &lt;ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"&gt; &lt;li data-role="list-divider"&gt;Navigation&lt;/li&gt; &lt;li&gt;&lt;a href="#pWhereAmI"&gt;Where am I&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div data-role="page" id="pWhereAmI"&gt; &lt;div data-role="header" data-id="mainHeader" data-position="fixed"&gt; &lt;h1&gt;Where Am I ?&lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content" class="map-content"&gt; &lt;ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"&gt; &lt;li data-role="list-divider"&gt;Navigation&lt;/li&gt; &lt;li&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;br /&gt; &lt;ul data-role="listview" data-inset="true"&gt; &lt;li&gt;Position Unknown&lt;/li&gt; &lt;li id="map_canvas"&gt;&lt;/li&gt; &lt;li&gt;Center the map&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div data-role="footer" class="nav-glyphish-example" data-id="mainFooter" data-position="fixed"&gt; &lt;div data-role="navbar" class="nav-glyphish-example" data-grid="d"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#pLogin" id="home" data-transition="fade" data-icon="custom"&gt;&lt;small&gt;Login&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /page pWhereAmI --&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload