diff --git a/examples/mobile-jq.js b/examples/mobile-jq.js index 73cb6bc40e..5d38d9b0cf 100644 --- a/examples/mobile-jq.js +++ b/examples/mobile-jq.js @@ -1,36 +1,34 @@ +// Start with the map page +window.location.replace(window.location.href.split("#")[0] + "#mappage"); + var selectedFeature = null; $(document).ready(function() { - // Start with the map page - if (window.location.hash && window.location.hash!='#mappage') { - $.mobile.changePage('mappage'); - } - // fix height of content function fixContentHeight() { var footer = $("div[data-role='footer']:visible"), - content = $("div[data-role='content']:visible:visible"), - viewHeight = $(window).height(), - contentHeight = viewHeight - footer.outerHeight(); + content = $("div[data-role='content']:visible:visible"), + viewHeight = $(window).height(), + contentHeight = viewHeight - footer.outerHeight(); if ((content.outerHeight() + footer.outerHeight()) !== viewHeight) { - contentHeight -= (content.outerHeight() - content.height()); + contentHeight -= (content.outerHeight() - content.height() + 1); content.height(contentHeight); } + if (window.map) { map.updateSize(); } else { // initialize map init(function(feature) { selectedFeature = feature; - $.mobile.changePage($("#popup"), "pop"); + $.mobile.changePage("#popup", "pop"); }); + initLayerList(); } } $(window).bind("orientationchange resize pageshow", fixContentHeight); - fixContentHeight(); - //init(); // Map zoom $("#plus").click(function(){ @@ -48,7 +46,7 @@ $(document).ready(function() { } }); - $('div#popup').live('pageshow',function(event, ui){ + $('#popup').live('pageshow',function(event, ui){ var li = ""; for(var attr in selectedFeature.attributes){ li += "