Posted By

craymond on 08/26/11


Tagged

google jquery maps mobile


Versions (?)

Mobile - Google Maps


 / Published in: JavaScript
 

  1. $('#idPage').live('pagecreate', function(event, ui) {
  2. option = {
  3. zoom: 16,
  4. mapTypeId: google.maps.MapTypeId.ROADMAP
  5. };
  6. map = new google.maps.Map(document.getElementById("map_canvas"), option);
  7. });
  8.  
  9.  
  10. $('#idPage').live('pageshow', function(event, ui) {
  11. var dataCoords;
  12. $.ajax({
  13. type: 'GET',
  14. async: false,
  15. url: './_ajax/coordsMap.php',
  16. data: 'qCoords=1',
  17. success: function(msg) {
  18. dataCoords = jQuery.parseJSON(msg);
  19. },
  20. error: function(msg) {
  21. alert('error qCoords');
  22. }
  23. });
  24.  
  25. latlng = new google.maps.LatLng(dataCoords.lat, dataCoords.lon);
  26. map.setCenter(latlng);
  27.  
  28. var marker = new google.maps.Marker({
  29. position: latlng,
  30. map: map,
  31. });
  32.  
  33. google.maps.event.trigger(map, 'resize');
  34. map.setOptions(option);
  35. });

Report this snippet  

You need to login to post a comment.