0

I have a location in my app, when I click on button, it will show me a map with marker on that location, when I click on marker it shows me a InfoWindow with details of that location. Now I want that when I click on that InfoWindow, another map page is open showing path between my current location and that location.

Is anybody suggest me that Is InfoWindow is clickable or not in mobile devices, so I move on next page.

Any help is appreciated. Thanks in advance.

Oops
  • 31
  • 1
  • 7

1 Answers1

0

It cant be done like that.

You have 3 other options:

  1. Look at this example and replace infoWindow with dialog box:

  2. Place click event on marker a display needed info on the another page:

    $('#map_canvas').gmap('addMarker', {
         'position': new google.maps.LatLng(parameters[j].lat, parameters[j].lng),
         'bounds': true
    }).click(function() {
          // Do something with marker
    });
    
  3. In case of google.maps.Map implementation there is a plugin used to create custom info box. It is called InfoBox, here and here you can find more about it. Style it as much as you want.

Here you will find an example how to add click event on infoWindow and infoBox (v2 and v3). After that just use this code to show a page you want:

$.mobile.changePage("#jobInfo", {transition: "none", reloadPage : false});
Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130
  • First option is not so good for mobile devices and in my app I am not using gmap. So is there any another way to solve this. Thanks – Oops Nov 26 '12 at 08:38
  • Which map implementation are you using? – Gajotres Nov 26 '12 at 08:58
  • map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); I use this. – Oops Nov 26 '12 at 09:01
  • Excellent, I have added a 3rd option, this one is built for your map implementation. – Gajotres Nov 26 '12 at 09:19
  • Thanks for the help,but in this example, it will create InfoBox, but I want that InfoBox is clicked and redirect to next page. var ib = new InfoBox(myOptions); ib.open(theMap, marker);this is already done by me. – Oops Nov 26 '12 at 09:58
  • Take a look now, I have added a link to the example how to do it. I don't have time to test it myself. – Gajotres Nov 26 '12 at 10:21
  • Thanku so much, may be its helpful for me. – Oops Nov 26 '12 at 10:44