Merge pull request #450 from fbuchinger/patch-2

simplified jquery mobile example
This commit is contained in:
Marc Jansen
2012-05-14 23:50:49 -07:00
+16 -9
View File
@@ -3,8 +3,6 @@ window.location.replace(window.location.href.split("#")[0] + "#mappage");
var selectedFeature = null; var selectedFeature = null;
$(document).ready(function() {
// fix height of content // fix height of content
function fixContentHeight() { function fixContentHeight() {
var footer = $("div[data-role='footer']:visible"), var footer = $("div[data-role='footer']:visible"),
@@ -28,17 +26,18 @@ $(document).ready(function() {
initLayerList(); initLayerList();
} }
} }
$(window).bind("orientationchange resize pageshow", fixContentHeight);
document.body.onload = fixContentHeight;
// Map zoom // one-time initialisation of button handlers
$("#plus").click(function(){
$("#plus").live('click', function(){
map.zoomIn(); map.zoomIn();
}); });
$("#minus").click(function(){
$("#minus").live('click', function(){
map.zoomOut(); map.zoomOut();
}); });
$("#locate").click(function(){
$("#locate").live('click',function(){
var control = map.getControlsBy("id", "locate-control")[0]; var control = map.getControlsBy("id", "locate-control")[0];
if (control.active) { if (control.active) {
control.getCurrentLocation(); control.getCurrentLocation();
@@ -47,6 +46,15 @@ $(document).ready(function() {
} }
}); });
//fix the content height AFTER jQuery Mobile has rendered the map page
$('#mappage').live('pageshow',function (){
fixContentHeight();
});
$(window).bind("orientationchange resize pageshow", fixContentHeight);
$('#popup').live('pageshow',function(event, ui){ $('#popup').live('pageshow',function(event, ui){
var li = ""; var li = "";
for(var attr in selectedFeature.attributes){ for(var attr in selectedFeature.attributes){
@@ -96,7 +104,6 @@ $(document).ready(function() {
$('#searchpage').die('pageshow', arguments.callee); $('#searchpage').die('pageshow', arguments.callee);
}); });
});
function initLayerList() { function initLayerList() {
$('#layerspage').page(); $('#layerspage').page();