Map Maker Sprite in OSX not displaying

35 views
Skip to first unread message

Clawg

unread,
Aug 9, 2012, 9:13:51 PM8/9/12
to google-map...@googlegroups.com

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);
           
}
       
}
   
});


Reply all
Reply to author
Forward
0 new messages