In pseudo code, here is what I want to do:
- Add a bunch of markers to your Google map.
- Add clicker for each marker - listener opens jQuery Mobile dialog
- When the dialog page is live (important for layout purposes), make an Ajax call and set the
srctag attribute imgusing the identifier attached to the marker.
I find that managing the flow of events is a bit complicated.
function setUpPhoto(id) {
$('#photo-image').attr({ src: image_url });
}
function addNewMarker(v) {
var map_marker = new google.maps.Marker({
position: v.latlng,
title: v.caption
});
map_marker.setMap(map);
google.maps.event.addListener(map_marker, 'click', function() {
$.mobile.changePage($("#photo"), 'pop', false, true);
setUpPhoto(v.id);
$('#photo').live('pageshow', function (event, ui) {
getIndividualPhoto(v.id, '');
});
});
}
$.each(data.marker, function(i,v) {
addNewMarker(v);
});
This is simplified code - the actual page I am having the problem on is located at http://cyclestreets.darkgreener.com/location/ (scroll to the location in London and the UK to see some markers)
Thank you for your help.
source
share