Jayme
Jayme

Reputation: 1

JQuery mobile and google maps: How to link to html page from marker click on the map

I am trying to add a click function to a marker in google maps inside jquery mobile which would jump to a html page that represents that marker. Here is my code so far.

$('#gmap-4').live("pageshow", function () {
                $('#map_canvas_2').gmap({ 'center': getLatLng(), 'zoom' :8, 'callback':
                        function (map){
                $('#map_canvas_2').gmap('addMarker', { 'title': 'Ashleys Restaurant', 'bound': true, 'position': new google.maps.LatLng(-34.176727, 140.743225),'icon':new google.maps.MarkerImage("images/restaurant.png") }, function(map, marker) {  
    $(marker).click( function() { 

Upvotes: 0

Views: 1121

Answers (1)

Ruslan
Ruslan

Reputation: 10147

So have you tried using $.mobile.changePage() as per documentation?

$('#gmap-4').live("pageshow", function () {
  $('#map_canvas_2').gmap({ 'center': getLatLng(), 'zoom' :8, 'callback':
    function (map){
      $('#map_canvas_2').gmap('addMarker', 
        { 'title': 'Ashleys Restaurant', 
          'bound': true, 
          'position': new google.maps.LatLng(-34.176727, 140.743225),
          'icon':new google.maps.MarkerImage("images/restaurant.png") 
        }, 
        function(map, marker) {  
          $(marker).click(function() {
            $.mobile.changePage(url);
    });
...

Upvotes: 1

Related Questions