I can't seem to get the my map markers to display when I use an image 
sprite on the iphone. They appear when I use the standard google map 
markers on iphone and when viewing the site in the desktop the sprite icons 
work fine.

Here is the code I use to create the markers, I am using Zepto but JQuery 
could as easily apply.

$.ajax({
    dataType: 'jsonp',
     url: myLocations.LocatorUrl,
     timeout: 8000,
     success: function(data) {
        var infoWindow = new google.maps.InfoWindow();
        var bounds = new google.maps.LatLngBounds();                            
        $.each(data, function(index, item){                 
            var data = item, pincolor,
            latLng = new google.maps.LatLng(data.lat, data.lng); 
            var d = 'http://blah';
            var pinImage = new 
google.maps.MarkerImage(d+"/assets/img/sprite.locator.png",                     
     
                        new google.maps.Size(24, 36),
                        new google.maps.Point(0,25),
                        new google.maps.Point(10, 34));
            // Creating a marker and putting it on the map
                var marker = new google.maps.Marker({
                    position: latLng,
                    map: map,
                    title: data.type,
                    icon: pinImage

                });

                bounds.extend(latLng); // Extend the Latlng bound method        
            
                var bubbleHtml = '<div 
class="bubble"><h2>'+item.type+'</h2><p>'+item.address+'</p></div>'; // Custom 
HTML for the bubble
                (function(marker, data) {                   
                  // Attaching a click event to the current marker              
  
                  google.maps.event.addListener(marker, "click", function(e) {  
                
                    infoWindow.setContent(bubbleHtml);
                    infoWindow.open(map, marker);
                  });   
                  markers.push(marker); // Push markers into an array so they 
can be removed
                })(marker, data);
            });
            map.fitBounds(bounds); // Center based on values added to bounds    
    
        }, error: function(x, t, m) {
            console.log('errors')
            if(t==="timeout") {
                alert("got timeout");
            } else {
                alert(t);
            }
        }
    });


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/seYVmGFgJa8J.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to