Return to Snippet

Revision: 50580
at August 26, 2011 23:09 by craymond


Initial Code
$('#idPage').live('pagecreate', function(event, ui) {
	option = { 
		zoom: 16,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	map = new google.maps.Map(document.getElementById("map_canvas"), option);
});


$('#idPage').live('pageshow', function(event, ui) {
	var dataCoords;
	$.ajax({
		type:	'GET',
		async:	false,
		url: 	'./_ajax/coordsMap.php',
		data:	'qCoords=1',
		success: function(msg) {
				dataCoords = jQuery.parseJSON(msg);
			},
		error:	function(msg) {
			alert('error qCoords');
		}
	});

	latlng = new google.maps.LatLng(dataCoords.lat, dataCoords.lon);
	map.setCenter(latlng);
	
	var marker = new google.maps.Marker({
		position: latlng,
		map: map,
	});
	
	google.maps.event.trigger(map, 'resize');
	map.setOptions(option);
});

Initial URL


Initial Description


Initial Title
Mobile - Google Maps

Initial Tags
google, jquery, mobile

Initial Language
JavaScript