简体   繁体   中英

Adding infoWindow to markers using Google Maps on jQuery mobile framework

I have some problems with Google Maps over jQuery mobile ... I have successfully integrated a geolocation snippet into the website I'm working on, and it's working perfectly but I would like to add also (for each marker) an infoWindow (activate by user click/tap). I tried several times and googled a while already but it seams everything fails to work and I don't get any error messages neither.

My current code is here: http://jsfiddle.net/Cde9j/5/

Basically I want to add for each marker an infoWindow or at least a label which to contain a link to an internal page of the website.

Also, please note that the 2 markers in the current jsfiddle code are placed in London so depending on your location you might want to zoom out the map to see them.

I would really appreciate any ideas to help me solve this.

Thanks!

Have you tried using google.maps.InfoWindow() ?

google.maps.event.addListener(markerObj, 'click', function() {
    var infoWindow = new google.maps.InfoWindow({content:"Your content"});
    infoWindow.open(map, this);
});

(Depending on whether to replace the the markers later on, you may also want to keep track of them using a global array..)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM