Reputation: 1
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
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